Opened 14 years ago
Closed 12 years ago
#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: | |
Blocked by: | Blocking: |
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 (4)
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
Milestone: | TBD → 1.8 |
---|
Consider using the same-domain check used by jQuery core for JSONP.
comment:3 Changed 12 years ago by
Here is how i fix this issue. The ZeK solution won't work 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 12 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
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 :
Changed by :