Skip to content Skip to sidebar Skip to footer

Java Script Is Not Redirecting Using Window.location

I am calling the js function from the href function topicApproval() { var approve = confirm('Do you wish to proceed?'); if(approve) { window.location('http://www.sample.com');

Solution 1:

Use:

window.location = 'http://sample.com';

More info

Solution 2:

You cal also use

window.location = 'http://sample.com';
window.location.href="http://www.example.com/";  and
window.location.replace('example.html');

for more details here

Solution 3:

Why not using document.location.href = 'http://location.com' which is supported by every browser.

Post a Comment for "Java Script Is Not Redirecting Using Window.location"