window.location is a property in JavaScript for getting the current page's location.
Questions tagged [window.location]
671 questions
14
votes
3 answers
Use of window.location doesn't work on iPad
I'm using some JavaScript that will redirect the user to another URL after a fixed period of time. This is working well on all browsers but on an iPad 3 I have to test on it isn't working. The timeout fires and I call
window.location =…

LDJ
- 6,896
- 9
- 52
- 87
12
votes
2 answers
Is window.location() same as a GET request?
Are cookies preserved while doing windows.location(url), if domain of url is the domain of the current page?

Nullpoet
- 10,949
- 20
- 48
- 65
11
votes
3 answers
javascript how to switch pathname of window.location property and redirect
I want to redirect a user from varying urls to a specific one. I've tried various flavors of replacing and I cant seem to get the behavior I want. This code works except I'm providing the hostname. I want to use the existing hostname from…

Hcabnettek
- 12,678
- 38
- 124
- 190
11
votes
2 answers
Create a link that either launches iOS app, or redirects to app store
Possible Duplicate:
Is it possible to register a http+domain-based URL Scheme for iPhone apps, like YouTube and Maps?
I have a custom URL scheme for my iOS app, and I want to be able to email a link to someone that will either launch the app if…

Silromen
- 1,131
- 2
- 10
- 18
11
votes
2 answers
Waiting time is high when using window.location.href OR .assign or .reload
I'm using JavaScript redirects after ajax call (after update content). I've tried below methods, all are very slow. In Network tab it shows waiting time is around 4.44 to 5 seconds. (Which is very frustrating for customers :(…

shyammakwana.me
- 5,562
- 2
- 29
- 50
11
votes
3 answers
How do I detect if window.location failed?
How do I check if a call to window.location failed because the given URL was invalid, etc? Is there some event I can set on the window object or on some other object that can catch this?

Sagi Mann
- 2,967
- 6
- 39
- 72
11
votes
3 answers
window.location redirect works, but original URL not showing up in browser history
The code below works well. Here is my problem: The window url redirects, but the original url is not logged in my browser history.
For example, if I visit "http://example.com/page1", the browser redirects to "http://example.com/test", as it should.…

user1546779
- 121
- 1
- 2
- 6
11
votes
8 answers
window.location Does not work in javascript
This code below for some reason doesn't work when trying to redirect. I have tried several other ways such as window.location.href and more. The only thing that works is window.open ("") but this opens a page in a new window when I need it to be on…

George Kashouh
- 111
- 1
- 1
- 3
9
votes
2 answers
Calling window.location.href in PhoneGap triggers web browser
Hello
I'm trying to develop an application for iPad using PhoneGap. I would like to dinamically load inside the index.html page the main page of an external website.
Unfortunately using
window.location.href =…

Claus
- 5,662
- 10
- 77
- 118
9
votes
3 answers
Triggering shouldStartLoadWithRequest with multiple window.location.href calls
Im trying to pass multiple things from a webpage inside a UIWebView back to my iPhone app via the shouldStartLoadWithRequest method of the UIWebView.
Basically my webpage calls window.location.href = "command://foo=bar" and i am able to intercept…

AlBeebe
- 8,101
- 3
- 51
- 65
9
votes
3 answers
Change window.location prototype to disable certain redirects?
I'm trying to selectively disable window.location, using Greasemonkey, at the start of the document.
I don't want to fully disable javascript, just disable some redirects done with javascript. They look like this:
window.location = "unwanted url";

affiszervmention
- 193
- 1
- 1
- 5
8
votes
4 answers
I want to use jQuery to get the location and the first folder with window.location
I want to get the location and the first folder, like:
http://www.example.com/test/
var $location = window.location.href;
alert ($location);
this returns
http://www.example.com/test/location-test.html
So I would like it to return everything up to…

user770252
- 83
- 1
- 5
8
votes
2 answers
Is window.location = window.location susceptible to XSS
This question is relating to the code window.location = window.location as a method to refresh the page and is not concerned with redirections / other variables.
My understanding is as follows:
window.location = window.location causes the page to…

Milk
- 2,469
- 5
- 31
- 54
8
votes
6 answers
$window.location.href NOT WORKING in AngularJS
I'm building a basic AngularJS Login page and the $window.location.href did not re-direct the page to a new html in my system, hosted by WAMP. I even tried re-directing it to google. Nothing happens. I tried all the available solutions here and…

Varun Nair
- 329
- 1
- 6
- 17
8
votes
3 answers
Angular $location.path() and window.location.reload not working in Safari/Firefox
For some reason this works in IE and Chrome but not Safari and firefox.
$location.path(lastPath);
$window.location.reload(true);
Instead of reloading the last path, $window.location.reload(true) the current page is reloaded. Where as in Chrome an…

Mike Lunn
- 2,310
- 3
- 21
- 24