Why Isnt Window.Location.Href= Not Forwarding to Page Using Safari

Why isnt window.location.href= not forwarding to page using Safari?

Best way work in all browsers:

setTimeout(function(){document.location.href = "user_home.html";},250);

window.location.href on Safari and Chrome

window.location.href is not a function and therefor you cannot call it, you can however assign a value to it: (Also you should be using http:// when redirecting to another domain)

$(".myButton").click(function(){
window.location.href = 'http://www.blahblahblah.com';
});

EDIT: Corrected my first statement and added the part about http://

window.location does not work in Chrome and Safari

use

window.location.href

instead of

window.location 

even better to use

The following works for me in current versions of IE, FireFox, Chrome, and Safari for Windows (fiddle = http://jsfiddle.net/MgX9U/)

window.location.replace("mailto:?subject=hi&body=content");

EDIT:
us setTimeout function before the second call, and make a delay for the second call.

Safari not opening a href with window.location.href

Try with either document.location.href or just location.href .

Hey there. Your code should work. Well i tried this simple example on Safari browser and it works good. Try yourself.

<html>
<head>
<script language="JavaScript" type="text/JavaScript">
function countClicks()
{
window.location.href = "http://www.stackoverflow.com";
}
</script>
</head>
<body onLoad=countClicks()>
</body>
</html>

Anchor Property : FYI : I have used window.open

<html>
<head>
<script language="JavaScript" type="text/JavaScript">
function countClicks()
{
window.open("http://stackoverflow.com", "_blank");
}
</script>
</head>
<body>
<a href="#" name="xy" onclick="javascript:countClicks(this);">Visit StackOverflow Website</a>
</body>
</html>

Passing variables from function

<html>
<head>
<script language="JavaScript" type="text/JavaScript">
function countClicks(a,b)
{
window.open("http://stackoverflow.com?id="+a+"&id2="+b, "_blank");
}
</script>
</head>
<body>
<a href="#" name="xy" onclick="javascript:countClicks(2,3);">test</a>
</body>
</html>

Safari browser crashes on redirect window.location

Try window.open(pageurl);

 window.setTimeout(function () {
var end = (new Date()).valueOf();
if (end - start < 1000) {
window.setTimeout(function () {
window.open(pageurl);//will be redirected to webpage crash is happening here
}, 5);
window.location = storeurl;
} else {
window.location = pageurl;
}
}, 5);
window.location = appicationurl;// will defaultly open application


Related Topics



Leave a reply



Submit