XMLHttpRequest

G

Gianluca

Hi all,

I developed a portal using Joomla 1.0.13 and Joomlajax (a plugin to
implement Ajax in Joomla, based on Scriptaculous and Prototype) as
core.
I added some javascript code on index.php to use the XMLHttpRequest
object and all work fine on IE 6, FF, Opera, and Safari but I've a lot
of trouble with IE 7 on XP and Vista: "Access Denied" when I click on
some link.

The problem isn't systematic: sometime I can resolve with a refresh of
the page, sometime it seem impossible to view the page.
On my system (Windows XP + IE 7) I NEVER seen the problem.
I checked for a possibile "cross-domain", but all script that I call
are in the same domain.
This is the implementation for the XMLHttpRequest object:

function createQCObject() {

var xmlhttp=false;

/* running locally on IE5.5, IE6, IE7 */
if(location.protocol=="file:"){
if(!xmlhttp)
try{
xmlhttp=new ActiveXObject("MSXML2.XMLHTTP");
}
catch(e){
xmlhttp=false;
}
if(!xmlhttp)
try{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
xmlhttp=false;
}
}

/* IE7, Firefox, Safari, Opera... */
if(!xmlhttp)
try{
xmlhttp=new XMLHttpRequest();
}
catch(e){
xmlhttp=false;
}

/* IE6 */
if(typeof ActiveXObject != "undefined"){
if(!xmlhttp)
try{
xmlhttp=new ActiveXObject("MSXML2.XMLHTTP");
}
catch(e){
xmlhttp=false;
}
if(!xmlhttp)
try{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
xmlhttp=false;
}
}

/* IceBrowser */
if(!xmlhttp)
try{
xmlhttp=createRequest();
}
catch(e){
xmlhttp=false;
}

return xmlhttp;
}

Any ideas/suggestions?

Thanks in advance.

Gianluca
 
R

Richard Cornford

Gianluca said:
I developed a portal using Joomla 1.0.13 and Joomlajax (a
plugin to implement Ajax in Joomla, based on Scriptaculous
and Prototype) as core.
I added some javascript code on index.php to use the
XMLHttpRequest object and all work fine on IE 6, FF, Opera,
and Safari but I've a lot of trouble with IE 7 on XP and
Vista: "Access Denied" when I click on some link.

The problem isn't systematic: sometime I can resolve with
a refresh of the page, sometime it seem impossible to view
the page. On my system (Windows XP + IE 7) I NEVER seen the
problem. I checked for a possibile "cross-domain", but all
script that I call are in the same domain.
This is the implementation for the XMLHttpRequest object:
Any ideas/suggestions?

From Windows XP on Microsoft radically improved the integrity of memory
access (presumably a security measure). One of the impacts of this on
browser scripting is that if you, for example, store a reference to a
DOM node from a document in a FRAME or IFRAME in javascript in the
containing frame any attempts to access that object through the stored
reference after the contained FRAME/IFRAME's document had been unloaded
will produce a "Access denied" error. This was not the case with Windows
2000 and all predating Windows versions.

Of course that is just one specific example, but the code you posted is
insufficient for any assessment of whether this is even a relevant
consideration. Though this possibility can be ruled out if you can
demonstrate that IE 6 on windows XP is fine, as then it cannot be an OS
issue.

Richard.
 
G

Gianluca

From Windows XP on Microsoft radically improved the integrity of memory
access (presumably a security measure). One of the impacts of this on
browser scripting is that if you, for example, store a reference to a
DOM node from a document in a FRAME or IFRAME in javascript in the
containing frame any attempts to access that object through the stored
reference after the contained FRAME/IFRAME's document had been unloaded
will produce a "Access denied" error. This was not the case with Windows
2000 and all predating Windows versions.

Of course that is just one specific example, but the code you posted is
insufficient for any assessment of whether this is even a relevant
consideration. Though this possibility can be ruled out if you can
demonstrate that IE 6 on windows XP is fine, as then it cannot be an OS
issue.

Richard.

The "system" work fine on IE 6 on my pc, but on my pc IE 7 works too;
it could be negligible.
Do you have any idea to bypass the problem? You say that the code is
insufficient: do you have some
improvement to suggest?
References on the web are good.

Thanks for your answer.

Gianluca
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top