JavaScript Crashing my App!
I have an app that is almost ready, but I've found that with specific JavaScript, my app is crashing.
The following code works fine if _urlweb equals "http://www.google.com":
prevar theURL = localStorage.getItem("urlweb");
window.open(theURL, 'blank', 'location=yes');/pre
But I get a 404 error if the _urlweb variable equals "www.google.com".
I cannot always count on the user entering the http:// before the URL, so I wrote this simple code, but when I try to use it, it crashes the whole app (doesn't even run at all.)
prevar theURL = localStorage.getItem("urlweb");
if (theURL !== null && theURL !== "") {
If(theURL.substring(0,4) !== "http") {
theURL = "http://" + theURL;
}
window.open(theURL, 'blank', 'location=yes');
}/pre
Can anybody see why this would be happening?
Thanks!
Joseph