View Full Version : Ajax Include on IE7 offline

12-03-2007, 08:39 PM
1) Script Title: Ajax Includes script- Dynamic Drive DHTML code library

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxincludes.htm

My Test Site
http://martee.net/TestTabInclude/testInclude.html or

- testInclude.html
- testIncludeExt.html (uses external js file)
- ./js/testInclude.js

3) Describe problem: NOTE - This is probably the wrong forum to be asking this at, but here goes.

The Script works Wonderful on-line.

The Script works Wonderful off-line locally UNTIL I got this new machine, it has Vista and IE7. Actually further testing has shown it is not Vista but IE7. FF, etc all work good on XP and Vista.

What happens and this does appear to be a security issue, is that it first questions the Active Content, but after acknowledging that and telling it to go forth and do good, it then comes up with 'Access is Denied'.

Like I said, it runs great online, but testing locally it doesnt, anyone got a suggestion or idea or direction I can go in.

Thanks in advance

12-03-2007, 10:09 PM
This is an odd situation. It is due to the fact that these scripts were coded for IE 6, or before IE 7, or thinking primarily about the differences between IE 6 and other browsers.

You see, IE 7 can do Ajax the same way that other browsers do, but won't do it locally. The script could be rewritten to make IE 7 take the IE 6 path when the page is local, but it isn't really worth it. Test in FF locally, IE 7 online.

You can do something like:

function ajaxinclude(url) {
var page_request = false
if (window.XMLHttpRequest&&(!window.ActiveXObject||/http/.test(url))) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
catch (e){
page_request = new ActiveXObject("Microsoft.XMLHTTP")
} . . .

To force IE 7 into using the Active X approach locally, but this runs the risk of sometimes also making it do so live, and the window.XMLHttpRequest approach is considered more efficient, and can be run live on IE 7 browsers allowing javascript but not Active X, so is certainly more likely to work. Adding these extra conditions could possibly cause problems for other browsers as well. You could do this locally to test the layout of your script's output in IE 7 though, but use the script without this modification when uploading it to the server.

12-04-2007, 03:05 PM
Thank You...