opening a browser with a local variable
Posted: Sun Sep 23, 2012 7:45 pm
by Mike4997955
I'm using a button to open a web browser, and I get the URL from a local variable. Here's the javascript i'm using:
window.open("'+localStorage.getItem('GooglePicsURL')+'")
It opens a browser window, but not the correct URL. It open to: http://project.tiggzi.com/404.html
Is my javascript incorrect?
Thank you.
opening a browser with a local variable
Posted: Sun Sep 23, 2012 9:57 pm
by maxkatz
What is the correct URL? It opens what you have in window.open(..).
opening a browser with a local variable
Posted: Sun Sep 23, 2012 11:04 pm
by Mike4997955
The correct URL is https://www.google.com/search?&tbm=is...
But it can change because it is a variable. the local variable is GooglePicsURL, and the string isn't working in the open command. I thought that "'+localStorage.getItem('GooglePicsURL')+'" would get the string.
opening a browser with a local variable
Posted: Sun Sep 23, 2012 11:14 pm
by maxkatz
You don't need the ", just use this:
code
window.open(localStorage.getItem('GooglePicsURL'));
/code
opening a browser with a local variable
Posted: Sun Sep 23, 2012 11:18 pm
by Mike4997955