View Full Version : Access Denied Ajax

08-09-2008, 07:04 AM
1) Script Title: Dynamic Ajax Content

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

3) Describe problem: I've tested and retested on "clean" pages, yet I cannot get this script to work in IE7 or IE5. I keep getting a javascript error "Access is denied" Works fine in FF3 though.

08-09-2008, 08:25 AM
Not really a bug. How about the demo page on DD here? I think you will find that it works fine. And if you made your page live, it would be fine too. A real IE 5 would probably be OK too, even locally. The problem with IE 7 is that it can use the:


object, but will not do so locally due to security restrictions. The AJAX request can be rewritten so that even IE 7 will use the Active X request object when run locally, then it will work locally, but it is hardly worth bothering about in most cases.

08-09-2008, 06:26 PM
Ah, thank you so much john.

07-17-2009, 08:21 AM
First post and great site btw, saved my butt many times.

I am having exactly the same problem with this script in IE7 and IE8 but works fine in IE6.

1) Script Title: Dynamic Ajax Content
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm "as is" in IE7 and IE8

When I load the index.htm for this script in IE7 locally (Win Xp SP3) I first get the usual information/gold bar at the top of the window" IE has restrcited this webpage from running scripts or ActiveX controls that could access your computer. Click here for options"

I click on this to allow blocked content, get a warning message that says "do you want to let this file run active content?" Select yes and then when I click on the left column link like "Porsche Page" I get a "Do you want to debug this webpage.." and there is a small window below this saying

Line: 38
Error: Access is denied.

Line 38 according to the debugging in IE7 is below,
page_request.open('GET', url, true)

Does anyone know why this happens? In the previous post, jscheuer1 said "if you made your page live it would be fine" what do you exactly mean by this?

Are you saying if you upload this DD page and folders as is to a webserver running IIS or Apache the page would display and work as expected?

For this script in particular, is it essential that it is runs on a server running IIS or Apache etc? I was hoping to run it locally on a win2K3 server but if this is impossible as is then I will have to use in a way so it works.

08-04-2009, 01:19 PM
I have encountered the same problem in ie8.

After several test, I found that the statement "if you made your page live it would be fine" is true.

What it means is that if you're xml-file is on the INTERNET (NOT IIS in Windows XP mind you, that does not work either) and if you access that xml-file trough your:

page_request.open('GET', url, true);

where the argument 'url' is in a form: 'http://whatever_website_your_xml_file_is_posted_on/your_xml_file.xml'

then it will open and be displayed by your JavaScript.

Test it and let me know if it works.


03-10-2011, 10:08 AM
I am also struggling to find out this solution of "access denied " while calling ajax .

The Problem is if user visit your site with www like (URL address blocked: See forum rules) and your ajax url is without www like (URL address blocked: See forum rules) than that error will occur.

Solution is that you have to just call include www in ajax url when users visit with www your site and call without www when users visit your site witout www.

to get dynamic host name in javascript
use below code in javascript

url= 'http://'+location.host

include this url with your ajax url and it will work.

let me know if still your code not working


03-10-2011, 01:12 PM
That would work. Or if you can arrange for the url to be relative, it will automatically have the desired www. or not www. prefix.