window.location is a property in JavaScript for getting the current page's location.
Questions tagged [window.location]
671 questions
-1
votes
1 answer
window.location returns different value
I have a problem: https://ibb.co/ccx5c7
var _yolcuSayisiYetiskin = $("#slcYolcuYetiskin").text();
var _yolcuSayisiCocuk = $("#slcYolcuCocuk").text();
var _yolcuSayisiBebek = $("#slcYolcuBebek").text();
var _gidisOriginCode =…

Süleyman Sülün
- 7
- 1
-1
votes
2 answers
reconstruct window.location.href with if/else statements
I have a website with language preferences. When i click the button to change languages, everything works fine. The only issue is whenever I change the language, it takes the user right back to the homepage to http://localhost/en/
However, I have a…

KatherineMichelle
- 453
- 10
- 27
-1
votes
1 answer
PHP not redirecting to required page
My add_comment.php has a input type button with value "cancel" its not redirecting the user back to the post on which he wants to comment if he press cancel .My add comment button however works perfectly .Please advise.

Pioneer2017
- 537
- 2
- 5
- 11
-1
votes
1 answer
How to open top.location.href url in a new window in javascript
I had a function in my application which calls other domain url, I'm struggling to open that url in a new window when the function is executed.
sample code:
$('#btn').onClick(function(){ //This code is in my application.
//callOtherfn is a function…

rUI7999
- 129
- 1
- 3
- 20
-1
votes
3 answers
javascript fetching and a variable from the url
I have the following url
http://www.domain.co.uk/example/#project-471-1747
The end bit #project-471-1747 changes every time a project is saved.
I pretty sure using window.location this can be pulled but what I am struggling to do is find out how to…

James
- 39
- 8
-1
votes
1 answer
I cannot redirect to another page using ajax when use the php base_url
I am trying to redirect to another page when condition is true using ajax. But I cannot do it when I use the php base_url. But If I give the direct path (http://localhost/CRH/......), it works. I cannot find what the issue is use of base url.…

Lahiru Madushan Koralage
- 53
- 1
- 1
- 9
-1
votes
2 answers
window.location working only on index page
I've read the similar questions on SO but none of them helps.
I have this JS
$(document).keypress(function(e) {
if(e.which == 13) {
var txt = $('#srch').val();
if (txt.toUpperCase() === "abc".toUpperCase()){
…

nailoxx
- 9
- 6
-1
votes
1 answer
Second `window.location = mailto:` fails as long as first one is still open
I'm trying to open the local mail window using the javascript window.location.href=mailto:. However, my addresses exceed the maximum length. So I slice it into pieces, and send these one after the other, after a specific timeout. However,…

Hans
- 1
- 3
-1
votes
1 answer
Javascript page call function
I have javascript page that calling another page.
when the second page is called, I send request data to sql server to see how many
time the second page is called.
But always see that just once.
I've added dynamic querystring to prevent cache from…

Reza Akraminejad
- 1,412
- 3
- 24
- 38
-1
votes
4 answers
JS window.location not working
My window.location does not redirect the page to the required location. The same code with window.open works. The else statement also executes when the user name and password are incorrect. When the correct username and password is entered, it just…

lazycamper
- 107
- 1
- 8
-1
votes
1 answer
php or javascript to interpret button press
i've created a very simple php site which has a search box in it and several buttons. Depending on which button i press, i'd like to forward that search to a different page, e. g. google or bing. (So when the button for google is clicked, a google…

onedude99
- 11
- 2
-1
votes
1 answer
When is window.location.href = url gets executed?
For the following code
window.location.href = url;
$(window.document.body).append(compiledTemplate);
I want $(window.document.body).append(compiledTemplate);
to be appended on the new Page which will get opened, but it appends thecompiledTemplate`…

Rohit Kumar
- 829
- 2
- 12
- 21
-1
votes
1 answer
JavaScript window.location.href not working
I'm trying to redirect to a new URL using window.location.href which does not seem to work for a particular URL.
The page URL is:…

JadedEric
- 1,943
- 2
- 26
- 49
-1
votes
4 answers
show alert msg if location.search is missed by javascript
the page url is example.com/1/page.html?user=123456
need to check if the current page url contains
example.com/1/page.html
without
?user=123456
because this is dynamic variable
show alert msg hello .. by javascript check current url
if (…

Mamdouh Winningstar
- 25
- 2
- 7
-1
votes
2 answers
if window.location == index (homepage)
I wanna do a jquery action on every site except the homepage (index).
I can not find out how to setup the if-statement with window.location
thanks for your help

Corrado
- 11
- 1