PDA

View Full Version : AJAX Tabs and Internet Explorer



rgalgon
06-21-2006, 01:42 PM
Hi there,

I'm working on updating a website and I was really pleased with how AJAX Tabs looked and worked (I had been working on writing something similiar, but this saved me a lot of time).

Before I used it I tested the demo once it was setup on my server in all the major browsers and it worked.

However once I finished populating each of the tabs/pages with my own content it all stopped loading in Internet Explorer (IE)

The first tab always loads since the code for that information is all right there before the start function is called. However when you click on any subsequent tabs the bundled loading icon and "Requesting content..." appear but it never loads.

It still works fine in Firefox, Mozilla, and Safari however.

Any ideas?

rgalgon
06-21-2006, 03:09 PM
I got it working...sortof.

I'm running the site off a local tomcat server and periodically testing it off a temporary Sun Application Server, both of them do not use 80 for their port as they are testing servers and I don't want them conflicting with the production stuff on the server(s)

It seems that Firefox handles 8080 just fine for each subsequent request but even though internet explorer is loaded to say

localhost:8080/digiXJSP

every time it looks for the content to load into another tab it looks in

localhost/digiXJSP/..path to content..


I changed the configuration around locally so I can test in IE but does anyone have an idea for how to modify the script to take into account ports?

I quickly tried in the startajaxtabs function:


ajaxpage(this.getAttribute("href") + ":8080", this.getAttribute("rel"), this)


But that broke stuff.

rgalgon
06-22-2006, 02:16 PM
It turns out that it isn't an error in IE, its a problem (sortof) with the script.

offending segment:

var modifiedurl=ulistlink.getAttribute("href").replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+"/")

hostname returns the hostname portion of the url
host returns the hostname + the port

so the changed code would be

var modifiedurl=ulistlink.getAttribute("href").replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.host+"/")

Both IE & Firefox/Safari's take on what to do make sense, so neither is 'right'

ddadmin
06-22-2006, 09:36 PM
Yep, this is a bug of the script, and has been discussed here: http://www.dynamicdrive.com/forums/showthread.php?t=10077&highlight=port Looks like I should get to updating the script for this. I just didn't anticipate people running into this problem, or at least, rarely.

sjwoo
03-10-2008, 08:56 PM
This issue still hasn't been fixed in v2.1!

scrombie
06-02-2008, 04:06 AM
Thanks for this bug fix. My test site also runs on an non-standard port.

Would be nice to see this simple fix incorporated in the published script.

roberto.cr
07-17-2009, 09:26 AM
It turns out that it isn't an error in IE, its a problem (sortof) with the script.

offending segment:

var modifiedurl=ulistlink.getAttribute("href").replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+"/")

hostname returns the hostname portion of the url
host returns the hostname + the port

so the changed code would be

var modifiedurl=ulistlink.getAttribute("href").replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.host+"/")

Both IE & Firefox/Safari's take on what to do make sense, so neither is 'right'
THANK YOU!
I was having this problem on IE and really had no idea what was going on... thank you very much for sharing this solution :)
this is the best simple and open ajax tabs code there is, congratulations on getting it even better :)