window.location Questions

4

Solved

I'm currently setting the window.location.pathname property to redirect the user to a relative URL. The new URL has parameters, so the line of JavaScript looks like this: window.location.pathname ...
Bola asked 4/9, 2010 at 16:14

4

Solved

This is my code: <a href="http://www.google.com" onClick="window.location.href='http://www.yahoo.com';return false;" target="_blank">test</a> When you click it, it takes you to Yahoo...
Tarlatan asked 11/11, 2012 at 22:6

13

Solved

Is there a better way to convert a URL's location.search as an object? Maybe just more efficient or trimmed down? I'm using jQuery, but pure JS can work too. var query = window.location.search.sub...
Blucher asked 30/6, 2011 at 19:1

10

Solved

How can I force the web browser to do a hard refresh of the page via JavaScript? Hard refresh means getting a fresh copy of the page AND refresh all the external resources (images, JavaScript, CSS,...
Alagez asked 20/1, 2010 at 5:16

18

Solved

I have URL like: http://example.com#something, how do I remove #something, without causing the page to refresh? I attempted the following solution: window.location.hash = ''; However, this doe...
Corncrib asked 9/9, 2009 at 2:59

18

Solved

What's the difference between window.location and document.location? Should both of them reference the same object?
Impartible asked 12/3, 2010 at 6:33

11

I know this is a question much discussed but I can't figure out why it does not work for me. This is my function: function ShowComments(){ alert("fired"); var movieShareId = document.getElemen...
Encomium asked 2/4, 2013 at 8:2

3

Solved

There is a very particular edge case in cross-domain policies regarding the window.top.Location object... Let's say I have IFrame A , in domain www.bbb.com, living inside a page in domain www.aaa....
Emotionality asked 11/7, 2009 at 15:2

2

Solved

I need to reload a page in a success of an ajax call. I'm seeing some code (not mine) and there are two ways: success: function(obj) { //code location.href = location.href; } or success: functio...
Havenot asked 7/12, 2016 at 14:45

3

Solved

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 time...
Brecher asked 23/5, 2013 at 12:57

3

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 r...

3

Solved

Essentially what I'd like to do is something to the effect of this: window.location.href = "some_location"; window.onload = function() { alert("I'm the new location and I'm loaded!"); }; Is the...
Celina asked 11/12, 2012 at 0:14

2

Solved

So trying to figure out how to do this with window.location in Javascript. I'm sending users to our site with an appended URL with a Google Analytics code that I need to pass to an iframe src on th...

4

Solved

I have this simple script: $(document).ready(function(){ var $yoyo = window.location.hash; alert($yoyo); }); But I need to get rid of the # symbol as I'll be using the variable to locate div ...
Inter asked 30/7, 2010 at 23:14

7

Solved

I have a JavaScript file from a third party developer. It has a has link which replaces the current page with the target. I want to have this page opened in a new tab. This is what I have so far: ...
Medick asked 28/2, 2011 at 12:22

1

I am getting the error below in my nextjs application while building it. My nextjs application is configured with typescipt for building reasons though i am using js only. Build error occurred: Ty...
Haggadah asked 28/10, 2020 at 21:21

2

Solved

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: ...
Nowell asked 17/7, 2016 at 22:1

13

Solved

Is there any way to detect HTTP or HTTPS and then force usage of HTTPS with JavaScript? I have some codes for detecting the HTTP or HTTPS but I can't force it to use https: . I'm using the window...
Enrika asked 18/1, 2011 at 10:52

4

Solved

My website is http://www.collegeanswerz.com/. I'm using rails. The code is for searching for colleges. I want the user to be able to type in the colleges name, click enter, and be taken to the url,...
Lermontov asked 18/8, 2013 at 15:24

5

I have created a window.location.reload function in my javascript. I need to mock the reload function while testing in Jasmine since it keeps on looping. The test goes well when I run grunt jenki...
Malia asked 4/12, 2014 at 23:33

8

I want to redirect to Login page from every page in my website after session timeout. I try to set window.location to the login page: var ParentUrl = encodeURIComponent(window.parent.location.href...
Eldwin asked 3/1, 2013 at 8:42

5

Solved

I have code snippent which is executed on click of a link which is as below cj_redirecturl="/HomeWork/main/load_course"; utility.xhttprw.data(cj_redirecturl,{data:courseid},function(response){ i...
Unbuckle asked 21/11, 2011 at 9:23

3

Solved

Is it secure to use window.location.href without any validation? For example: <script> var value = window.location.href; alert(value); </script> From the above example, is it vuln...
Shevat asked 6/6, 2014 at 9:21

1

Solved

In my project I have a TabComponent which displays 3 tabs: home, popular, all. Now, I am using context of react to maintain: activetab which stores current tab. toggleTab method which changes ac...
Pipes asked 6/7, 2018 at 8:12

8

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 o...
Depositor asked 18/5, 2012 at 3:26

© 2022 - 2024 — McMap. All rights reserved.