Weird Hash in All of Joomla’s URLs – Cause and Fix

A client emailed us late at night yesterday and told us that all of the pages on his Joomla website have a weird hash in the URL. He told us that he just noticed the problem and he needed it fixed immediately. So, we checked the website and it was something we haven’t seen before: every page we went to had an anchor attached to it. For example, when clicking on the Our Services page on our client’s website, the link in the address bar was: http://www.ourclientjoomlawebsite/our-services.html#_U0123456789A. What was even weirder was that the link to the Our Services page did not contain that anchor!

So, we took a closer look and we discovered that the anchor was added after the page was fully loaded – which means that it was a JavaScript script that was doing this mess. After a lot of investigation (we’re saving you hours here!), we discovered that it was a piece of code used to display the AddThis widget which was responsible for this. Here’s that code (the code was placed in a Custom HTML module):

<script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>

The code above explicitly instructs the browser (through JavaScript) to track data in the address bar – which means that it has to add the hash in order to track the data. Changing the above code to the below one fixed the problem:

<script type="text/javascript">var addthis_config = {"data_track_addressbar":false};</script>

Now – after fixing it, we started wondering: how come the people at AddThis (which is a hugely used widget) allow for such a poor technique for tracking their famous product? And how many other JavaScript widgets have the same problem? We then thought that we were right in being always cautious when referencing JavaScript code located on a 3rd party website; you never know when this code goes berserk and starts doing weird things on a website!

So, if you’re having the problem where a weird hash suddenly shows up in the URL of each and every page of your Joomla website, then take a look at the module containing the AddThis code, and try to fix it using our above method. If you don’t have AddThis, then it might be another JavaScript code doing this (to confirm this, try disabling JavaScript on your browser and see if the problem’s still there). If this is the case (e.g. the problem is caused by another JavaScript code) and if you can’t fix it yourself, then how about asking for our help? Just contact us and we’ll fix the problem for you as quick as possible and for a very reasonable cost!

2 Responses to “Weird Hash in All of Joomla’s URLs – Cause and Fix”
  1. Comment by Matt — June 28, 2015 @ 5:57 am

    I just wanted to let you know, this helped me tremendously. I would also like to add that I found the line of code in the database, in case somebody else makes the same mistake I did by trying to find it in the files first. Anyway, much appreciated!

  2. Comment by Fadi — June 29, 2015 @ 12:44 am

    Hi Matt,

    Glad you found this post helpful! Sadly, many other JavaScript plugins do the same thing nowadays for their internal tracking.

Leave a comment