Skip to main content

Search and Top Navigation

#4033 closed bug (fixed)

Opened February 01, 2009 01:05PM UTC

Closed February 25, 2009 08:25PM UTC

Last modified November 10, 2009 04:18PM UTC

Tab hrefs may be converted to full URLs in IE, then misinterpreted as ajax tabs

Reported by: mgl Owned by: klaus.hartl
Priority: minor Milestone: 1.7
Component: ui.tabs Version: 1.6rc6
Keywords: Cc:
Blocked by: Blocking:
Description

I already posted about this in Google groups. After upgrading an application I've been working to jQuery 1.3.1 and UI 1.6rc6, I encountered a problem where some UI dialogs I have that contain tabs would not load properly in IE 6/7. The code below exemplifies the problem. I have been able to fix this problem in my case by adding:

if (href.indexOf("#")>0) href = href.substring(href.indexOf("#"));

at line 65 in ui.tabs.js. I don't know if this is a proper solution, but it fixes the problem in my specific case.

Here's the example that recreates the problem I encountered.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>Dialog Bug</title>
		<link rel="stylesheet" type="text/css" href="../css/ui.all.css" />
		<script type="text/javascript" src="../js/jquery/jquery.js"></script>
		<script type="text/javascript" src="../js/jquery/ui/ui.core.js"></script>
		<script type="text/javascript" src="../js/jquery/ui/ui.draggable.js"></script>
		<script type="text/javascript" src="../js/jquery/ui/ui.resizable.js"></script>
		<script type="text/javascript" src="../js/jquery/ui/ui.dialog.js"></script>
		<script type="text/javascript" src="../js/jquery/ui/ui.tabs.js"></script>
		<script>
		
			var tabdialog = function()
			{
				var t = this,
					content = (t.content = $('<div />').dialog()),
					divTabs = (t.divTabs = $('<div><ul><li><a href="#tab1">Tab 1</a></li><li><a href="#tab2">Tab 2</a></li></ul><div id="tab1">stuff here</div><div id="tab2">stuff here</div></div>')
						.appendTo(content).tabs());
			}
			
			$(document).ready(function(){
				var x = new tabdialog();
				x.content.dialog("open");
			});
		</script>
	</head>
	<body>
	</body>
</html>
Attachments (0)
Change History (8)

Changed February 01, 2009 02:56PM UTC by klaus.hartl comment:1

milestone: TBD1.6
owner: → klaus.hartl
priority: minorcritical
status: newassigned

Changed February 01, 2009 03:15PM UTC by klaus.hartl comment:2

summary: Tab IDs may be converted to full URLs in IE, then misinterpreted by ui-tabsTab hrefs may be converted to full URLs in IE, then misinterpreted as ajax tabs

Changed February 01, 2009 09:13PM UTC by klaus.hartl comment:3

resolution: → fixed
status: assignedclosed

[1948]

Changed February 25, 2009 04:00PM UTC by syragon comment:4

This issue has only been fixed in the case there is no <BASE HREF> element within the HTML document.

When the above tag is defined, you can end up with a scenario where:

Current page URL in browser = www.domain.com/some_page.html

AND

Base Href = www.domain.com/

AND

<a href="#tabs-1"> = www.domain.com/#tabs-1 (In IE)

SHOWS

href.split('#')[0] = www.domain.com/

AND SHOWS

location.toString().split('#')[0] == www.domain.com/some_page.html

Resulting in the expression: (href.split('#')[0] == location.toString().split('#')[0]) never returning true.

I hope a fix for this is released soon, I had to hack the code. I noticed UI has not been updated in a while.

Changed February 25, 2009 07:30PM UTC by klaus.hartl comment:5

resolution: fixed
status: closedreopened

Changed February 25, 2009 07:30PM UTC by klaus.hartl comment:6

priority: criticalminor
status: reopenedassigned

Changed February 25, 2009 08:25PM UTC by klaus.hartl comment:7

resolution: → fixed
status: assignedclosed

[2131]

Changed November 10, 2009 04:18PM UTC by justlost comment:8

I encountered the same issue Syragon stated.

All its needed to fix it is:

change:

if (href.split('#')[0] == location.toString().split('#')[0]) href = a.hash; 

to:

if (location.toString().split('#')[0].search(href.split('#')[0]) > -1 ) href = a.hash; 

I used this to fix my issue, it searches for the base url in href on the document location.