PDA

View Full Version : Ajaxtab does not work in IE7 ?



Xian
04-20-2007, 03:23 AM
Hi everyone,

I have got a webpage running the Ajaxtab http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/, it works fine in Firefox and Ie6 however when i load the page on IE 7, whenever i click on the tabs i get the page cannot be found error. Can anyone help me with this thanks in advance.:)

codeexploiter
04-20-2007, 03:28 AM
Are you sure that the external file you are referring exists in the correct path?

If it is possible provide either a link to your page or the source code.

Ajax Tabs Content script demo page provided in DD works without any error.

Xian
04-20-2007, 03:51 AM
Hi
As im running the page on a localhost i am unable to provide the link but here is the source code.

<div id="content2"><!--Start of #content2-->

<ul id="maintab" class="shadetabs">
<li class="selected"><a href="#default" rel="ajaxcontentarea" onmouseover="return escape('Home sweet home')">Home</a></li>
<li><a href="phpinfo.php" rel="ajaxcontentarea" onmouseover="return escape('Speakers')">Speakers</a></li>
<li><a href="program.php" onmouseover="return escape('Get to know our programmes')">Program</a></li>
<li><a href="external.htm" rel="ajaxcontentarea" onmouseover="return escape('Take a look at our sponsors')">Sponsors</a></li>
<li><a href="external.htm" rel="ajaxcontentarea" onmouseover="return escape('Whos presenting?')">Presentation</a></li>
<li><a href="reg.php" rel="ajaxcontentarea" onmouseover="return escape('What are you waiting for?')">Registration</a></li>
</ul>
The page links fine when i remove the rel="ajaxcontentarea" from the code. Thanks.

thetestingsite
04-20-2007, 03:57 AM
I don't think AJAX works in IE7 on localhost. That could be the reason why you get an error.

Hope this helps.

jscheuer1
04-20-2007, 04:57 AM
I don't think AJAX works in IE7 on localhost. That could be the reason why you get an error.

Hope this helps.

Right. But, it can if that is what you need it to do, change:


function ajaxpage(url, containerid, targetobj){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false

to:


function ajaxpage(url, containerid, targetobj){
var page_request = false
if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else
return false

I think you can see what's happening here which is - IE 7 now supports window.XMLHttpRequest but, not locally while, it still supports window.ActiveXObject locally (with permission).

Xian
04-20-2007, 05:58 AM
Thanks for the reply i got the page working on localhost now, but when i click on the tab now it does not show the cannot find content page but it seems to be unable to retrieve the content i see the ajax logo just keep spinning without the content loading.

jscheuer1
04-20-2007, 06:30 AM
Well, that depends upon what you mean by localhost. If you mean simply running it locally on your computer, the demo (ajaxtabscontent.zip (http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/ajaxtabscontent.zip)) works fine in IE 7 with that one change. If you mean something else and/or if you are loading pages that the browser might see as being on another domain, there could still be problems.