Skip to content
Advertisement

Tag: window.location

Reading the parameter values off the current URL on page load

I realize retrieving search params from the URL is a commonly asked Question but I am running into an issue with using URLSearchParams(window.location.search) because I believe it is searching for a ? and my url contains & as separators between values. my url will look something like this http://localhost:8080/monitor/patientName=Courtney+Patient&pageSize=50 My Goal is to pull out the searchParams in the url

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? Answer Finally got it to work using a “workaround” that is not a generic solution as I originally hoped: I am using the

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 and I’ve also tried I can see the URL in the browser changing to www.someurl.ocom but

What is the difference between “window.location.href” and “window.location.hash”?

I learned “window.location.hash” new and tried in my jquery code instead of “window.location.href” and both of them gave same results. Code is here : What is the difference between them? Answer For a URL like http://[www.example.com]:80/search?q=devmo#test hash – returns the part of the URL that follows the # symbol, including the # symbol. You can listen for the hashchange event

Changing window.location.href in Firefox in response to an onunload event

I have a strange JavaScript problem using window.location.href, which apparently only affects Firefox (I’m using 3.6). Normally window.location.href would not be read-only, and this works perfectly in Firefox: However, when I call a function in response to an onunload event (<body onunload=”testThis();”>), this doesn’t work as expected: In both cases, the alert displays the current location of the page in

How to remove the hash from window.location (URL) with JavaScript without page refresh?

I have URL like: http://example.com#something, how do I remove #something, without causing the page to refresh? I attempted the following solution: However, this doesn’t remove the hash symbol # from the URL. Answer Initial question: or both will return the URL without the hash or anything after it. With regards to your edit: Any change to window.location will trigger a

Advertisement