window.location is a property in JavaScript for getting the current page's location.
Questions tagged [window.location]
671 questions
6
votes
2 answers
Percent encoding in window.location
When I open a url with special characters using window.location, it seems to percent encode the special characters and then opens the URL. For example
var url = "http://gramfeed.com/instagram/tags/kühl";
window.location = url;
This will result in…

krisrak
- 12,882
- 3
- 32
- 46
6
votes
2 answers
Google apps script location.reload in web app
I am using a GAS web app that needs to refresh its contents when a user takes certain actions (like clicking on a particular div).
On the clientside, I have this script that gets called from…

perpetual
- 168
- 1
- 1
- 6
5
votes
3 answers
How to unit test page navigation?
Use case is this: I want to unit test (in browser, QUnit or something of the kind) a code run in a page. One of the things a page can do is to navigate away to another page. I have problem catching this event, because:
beforeunload cannot stop the…
user1046334
5
votes
4 answers
Using window.location.hash in jQuery
I would like to make a color fading navigation menu using jQuery, in which the "pressed" button corresponding to the current page behaves differently from the "unpressed" button (specifically, it doesn't fade to a different color upon hovering). If…

Kurt Peek
- 52,165
- 91
- 301
- 526
5
votes
1 answer
jQuery/Ajax page redirection is not working in iPhone and Safari
I am trying to redirect one page to another using jQuery/ajax. Here I am using php as server side.
This is how I send data to js:
$url = 'index.php?p=dashboard';
// print the message to Ajax:
$messages = array('success'=>true,'pageRedirect'=>$url);…

ugsgknt
- 115
- 8
5
votes
5 answers
Why won't window.location load a new page?
This bit of code used to work, and now it doesn't:
var url = myurl +'?id=' + id + '&phase=' + phase;
window.location = url;
Using the IE dev toolbar I've verified that url has a valid url, and window.location returns the new url...the only problem…

IronicMuffin
- 4,182
- 12
- 47
- 90
5
votes
2 answers
window.top.location vs window.location
how to sync window.top.location and window.location?

asdf_enel_hak
- 7,474
- 5
- 42
- 84
5
votes
2 answers
Javascript: window.location.search does not update?
I need to update search (query) parameters in URL if user enters those in search panel (on a page). I'm trying this:
$( document ).ready(function() {
if ($('.o_website_license_search_panel').length) {
$('.o_website_license_search_panel…

Andrius
- 19,658
- 37
- 143
- 243
5
votes
1 answer
if function with window.location.hash help
I have a function that changes the hash in the url and inserts/removes a div from my main page. I did this was so that I can have a page that you can maneuver through without a reload, but at the same time i wanted people to be able to bookmark a…

pobrien
- 63
- 1
- 4
5
votes
4 answers
Refresh the parent window from the child window in javascript
I have looked for awhile and cannot find an answer that fits my needs. I have a page that pops a window (window.open), logs the user in (creates a cookie, set session) then redirects to another page. While the modal is redirecting, I would like to…

Isaac Levin
- 51
- 1
- 1
- 2
5
votes
2 answers
Best way to "Exit" in javascript
My goal is to:
if(error){
window.location.href = "error.htm";
//end of every thing
}
What's more, return false wouldnt help because there may be functions inside of functions.
My current solution is throw, but i feel uncomfortable
Any…

rhapsodyn
- 3,272
- 5
- 29
- 36
5
votes
2 answers
Watching a $locationProvider in Angular.js
I need to watch changes on the URL bar and do certain actions based on that. I wondered what's the best way to add a watch to view changes to it?

Lior
- 40,466
- 12
- 38
- 40
5
votes
1 answer
AjaxSubmit with window.location on response
I have a problem with ajaxSubmit... The problem is that, when I submit a form and get a response from PHP that have a script with window.location, the page doesn't change at all...
My PHP script just returns a script with window.location when the…

Cristiano Santos
- 2,157
- 2
- 35
- 53
4
votes
1 answer
Window.Location Not Working In IE?
I have been trying to figure this out all afternoon, but have given up and now turning to you clever people to help :)
I have the following Jquery/Javascript function, which is working fine in Chrome - BUT in IE nothing happens?
…

YodasMyDad
- 9,248
- 24
- 76
- 121
4
votes
0 answers
Setting filename using encodeURIComponent() to let user download data file
Alright, so I have this webpage page that gets its data using AJAX requests (in javascript using JQuery). Once the data has been loaded on to the users browser I want to let them download said data without having to request it from the server…

DJ SymBiotiX
- 187
- 2
- 12