Ticket #4941 (closed bug: fixed)
Mishandling of base tag
| Reported by: | ZeK | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.9.0 |
| Component: | ui.tabs | Version: | 1.8a1 |
| Keywords: | base tabs baseurl ui bug | Cc: | |
| Blocking: | Blocked by: |
Description
Hello, i have some troubles with tabs, it doesn't manage well the base tag.
Let's say i have a page on http://www.domain.com/dir/page.html and i set a base like this :
<base href="http://www.domain.com/" />
So, if i want to have tabs, my link will look like this :
<a href="dir/page.html#mytab">My Tab</a>
But, jquery considers the tab like a remote tab.
The code is in ui.tabs.js, line 91 (on 1.8a1) :
if (hrefBase && (hrefBase === location.toString().split('#')[0] ||
(baseEl = $('base')[0]) && hrefBase === baseEl.href)) {
In my example :
- baseEl.href = " http://www.domain.com/"
- hrefBase = "dir/page.html"
- location.toString().split('#')[0] = " http://www.domain.com/dir/page.html"
I can't find any example where the second line could be true. But, what could work for the base, is that :
(baseEl = $('base')[0]) && location.toString().split('#')[0] == baseEl.href+hrefBase
I tested it, works in my case.
Thanks.
Change History
comment:2 Changed 4 years ago by joern.zaefferer
- Milestone changed from TBD to 1.8
Consider using the same-domain check used by jQuery core for JSONP.
comment:3 Changed 2 years ago by mriffault
Here is how i fix this issue. The ZeK solution didn't works for me :
// inline tab
if( $('base')[0] ) {
var locHref = location.href;
nvar pURL = locHref.replace($('base')[0].href, '/');
}
if (fragmentId.test(href) ||
$('base')[0] && pURL == hrefBase ) {
self.panels = self.panels.add(self._sanitizeSelector(a.hash));
}
I test if the hrefed page is the current page... So i think it is a good way to solve this problem...
comment:4 Changed 22 months ago by Scott González
- Status changed from new to closed
- Resolution set to fixed
Tabs: Fixed detection of local vs. remote tabs. Fixes #4941 - Mishandling of base tag. Fixes #4836 - Self refering href only partially detected.
Changeset: 18a3b539882835ecc78ed976a7d9e830c128fd96


My solution was a messy solution (it modifies the URL)
What seems to work better line 97 :
// inline tab if (fragmentId.test(href)) { self.panels = self.panels.add(self._sanitizeSelector(href)); }Changed by :
// inline tab if (fragmentId.test(href) || (baseEl = $('base')[0]) && location.toString().split('#')[0] == baseEl.href+hrefBase) { self.panels = self.panels.add(self._sanitizeSelector(a.hash)); }