0

I am not sure how to show the issue here, so I will do my best to describe it.

The dev system I am using is built on AEM 5.6.1, and the issue I am running into is that a certain url structure on our site used to work, and with the most recent codebase, it no longer does. I have not been able to find changes in the code (between build versions) that would affect this.

Example of the STARTING URL:

http://localhost:4502/path.html

Example of the old URL:

http://localhost:4502/path.html#card/path/jcr:content/something/test?comment

What it is now getting changed into:

http://localhost:4502/card/path/jcr:content/something/test?comment

Here is the weird part, and why I think the issue is related to something with the hashchange event... In my experience, if I have a console logger set up like this:

$(window).on('hashchange', function() {
  console.log("hash changed to: " + location.hash)
});

Every time the url changes after the #, I would see the new hash in the console. In my example though, I click on a link that is taking me to the old URL (specified above), but before my hashchange event fires, SOMETHING changes the URL to the new URL, and breaks the functionality of the page. The console logger will then fire, but there is no longer any hash, so it is empty, and acts as if nothing has changed until 2 changes have happened simultaneously.

Even more weird is that if I add random hashes to my url (like #test or #me), they will be registered and output to the console. Once I change my url to have a / after the #, the strange url change takes over, and I don't see anything in the console (or get into a debug statement, if I put that into my block of code) until after that second change is done.

Is there any possibility of the hashchange event firing later than normal somehow? The hash does change, and also gets removed before I am even getting any feedback from the browser whatsoever. I am using Chrome, but have tried this in various browsers with the same result. Any help would be appreciated.

0 Answers0