jQuery Tabs load page inside tab when URL has query parameters
I have jQuery tabs with 2 tabs on a page. They are both local (no remote content.)
When the URL does not contain a question mark, the jQuery tabs work fine. But when the URL has a question mark, it will load the whole page inside the tab (page "INCEPTION.")
Tracing the code that loads the page, I found this function in jquery-ui.js:
- function isLocal( anchor ) {
- return anchor.hash.length > 1 &&
- decodeURIComponent( anchor.href.replace( rhash, "" ) ) ===
- decodeURIComponent( location.href.replace( rhash, "" ) );
- }
The problem is location.href contains the question mark but anchor.href does not.
- // anchor.href = "http://localhost/edit#tab1"
- // location.href = "http://location/edit?id=1"
After the hash and fragment identifier are removed, the URLs is still different, and the function returns false in this case.
Am I doing something wrong or is this bug in jQuery UI. Also, is there a quick fix? Editing the code in jquery-ui.js is out of the question because I am using a CDN.
Note: when the URL is "http://localhost/edit" it works fine.
Thanks in advance.
Lian