0

I'm trying to test if the page has a certain query string in front of the address so I'm using window.location.href (or window.location.search) but it shows the domain followed by the file name (html file).

This is what I'm using:

var currURL = window.location.href;

I also tried to use the setTimeout fork as well, thinking the query string might be added later on the pipeline (I didn't develop the website so I don't know) but that's not the problem.

BUT WAIT! The most intriguing part is yet to come. If I do window.location.href on chrome's console I get the correct URL. What gives?

--

EDIT (duplicate justification): This is not a duplicate of How can I get query string values in JavaScript? because that question dealt with how to get individual strings and all. I tried that but my problem is that it relies on window.location.href as well, so it returns the null on the query string.

--

EDIT (more info): I'm not sure it will be useful for most of you, because the address is for a brazillian Portuguese website. In any case, here is the page in question. There is a previews js error but I don't think it's interfering: Uncaught TypeError: Cannot read property 'style' of null. Will have a look at that.

Community
  • 1
  • 1
Digger
  • 718
  • 1
  • 9
  • 22

0 Answers0