Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-18-2008, 11:14 AM   PM User | #1
mlse
Regular Coder

 
mlse's Avatar
 
Join Date: Mar 2005
Posts: 624
Thanks: 20
Thanked 19 Times in 18 Posts
mlse is on a distinguished road
Access Denied from Localhost

Hi all,

My use of AJAX is coming along nicely, BUT - I have noticed something strange! On my development machine, if I load a page on my local webserver (Apache 2 runing under Debian Etch) via it's IP address, AJAX works fine. However, when I load it via the L.O. (localhost), I get the javascript error uncaught exception: Permission denied to call method XMLHttpRequest.open.

Weird.

Any ideas, without seeing my code? I'll post if it will help.

TIA,
Mike.

Last edited by mlse; 04-18-2008 at 11:45 AM..
mlse is offline   Reply With Quote
Old 04-18-2008, 01:51 PM   PM User | #2
Stooshie
Regular Coder

 
Stooshie's Avatar
 
Join Date: Mar 2008
Location: Dundee, Scotland
Posts: 376
Thanks: 9
Thanked 39 Times in 39 Posts
Stooshie is on a distinguished road
If the server part of the url in the address bar is different to the server part of the address you are calling via AJaX then security permissions kick in.

If you are loading the page initially using the IP address, then you should call the AJaX through that address.

If you are using localhost then the same should be used for the AJaX.

This may seem strange at first because they are essentially the same machine. The security settings don't know that localhost and your IP address are the same. Your IP address could change.
__________________
Regards, Stooshie
O
Stooshie is offline   Reply With Quote
Old 04-18-2008, 04:50 PM   PM User | #3
mlse
Regular Coder

 
mlse's Avatar
 
Join Date: Mar 2005
Posts: 624
Thanks: 20
Thanked 19 Times in 18 Posts
mlse is on a distinguished road
Hi Stooshie, yep, I know that. All my calls are made using relative URLs so there shouldn't be a problem.
mlse is offline   Reply With Quote
Old 04-18-2008, 05:35 PM   PM User | #4
Stooshie
Regular Coder

 
Stooshie's Avatar
 
Join Date: Mar 2008
Location: Dundee, Scotland
Posts: 376
Thanks: 9
Thanked 39 Times in 39 Posts
Stooshie is on a distinguished road
Sorry will have to log off soon so might not be able to respond very soon. I'll ask you this anyway.

What browser are you using? If you are using firefox, you may need this link:

How to fix ajax error

If that's not the case do you access the internet via a proxy? I know that sounds daft when you are accessing localhost, but my work pc needs to go through the proxy to access my localhost server. If this is the case, then the proxy may be returning the code as if it from the IP address even when you have localhost in the address bar. In which case, the quick solution is just to use the IP address.

Hope that is some help.
__________________
Regards, Stooshie
O
Stooshie is offline   Reply With Quote
Old 04-18-2008, 08:09 PM   PM User | #5
mjlorbet
Regular Coder

 
mjlorbet's Avatar
 
Join Date: Jan 2008
Location: Milwaukee, WI
Posts: 724
Thanks: 8
Thanked 96 Times in 95 Posts
mjlorbet will become famous soon enough
by default in the security settings (for windows based machines anyways) localhost is in the restricted zone, adjust your security settings in internet explorer under zones.
__________________
-Mike
"Want me to precludify him, like some kind of dispatcherator?... Can do!" -Bender
mjlorbet is offline   Reply With Quote
Old 04-21-2008, 10:10 AM   PM User | #6
mlse
Regular Coder

 
mlse's Avatar
 
Join Date: Mar 2005
Posts: 624
Thanks: 20
Thanked 19 Times in 18 Posts
mlse is on a distinguished road
Hi all,

Thanks for your replies! I have no proxy, nor am I using IE ... I've put in a quick fix by getting localhost to redirect to the local IP address.
mlse is offline   Reply With Quote
Old 04-21-2008, 02:31 PM   PM User | #7
mjlorbet
Regular Coder

 
mjlorbet's Avatar
 
Join Date: Jan 2008
Location: Milwaukee, WI
Posts: 724
Thanks: 8
Thanked 96 Times in 95 Posts
mjlorbet will become famous soon enough
internet explorer doesn't itself matter, the security zones setting, however, is easily accessible through internet explorer's options
__________________
-Mike
"Want me to precludify him, like some kind of dispatcherator?... Can do!" -Bender
mjlorbet is offline   Reply With Quote
Old 04-21-2008, 03:50 PM   PM User | #8
oesxyl
Master Coder


 
Join Date: Dec 2007
Posts: 6,682
Thanks: 436
Thanked 890 Times in 879 Posts
oesxyl is a jewel in the roughoesxyl is a jewel in the roughoesxyl is a jewel in the rough
Quote:
Originally Posted by mlse View Post
Hi all,

Thanks for your replies! I have no proxy, nor am I using IE ... I've put in a quick fix by getting localhost to redirect to the local IP address.
I guess the problem is:

ls -l myscript.php
.... -r--r--r-- ... myscript.php

but must be:
.... -rw--r---r--- ... myscript.php

fix with:
chmod u+w myscript.php

regards
oesxyl is offline   Reply With Quote
Old 04-21-2008, 03:56 PM   PM User | #9
mlse
Regular Coder

 
mlse's Avatar
 
Join Date: Mar 2005
Posts: 624
Thanks: 20
Thanked 19 Times in 18 Posts
mlse is on a distinguished road
Hiya, nope, all my scripts have 644 permissions!

I have the work-around so thanks anyway
mlse is offline   Reply With Quote
Old 04-21-2008, 04:02 PM   PM User | #10
oesxyl
Master Coder


 
Join Date: Dec 2007
Posts: 6,682
Thanks: 436
Thanked 890 Times in 879 Posts
oesxyl is a jewel in the roughoesxyl is a jewel in the roughoesxyl is a jewel in the rough
Quote:
Originally Posted by mlse View Post
Hiya, nope, all my scripts have 644 permissions!

I have the work-around so thanks anyway
I'm glad you solve it. Please post the way you fix it for future search on forum. Could help someone Thank you.

regards
oesxyl is offline   Reply With Quote
Old 04-21-2008, 05:01 PM   PM User | #11
Stooshie
Regular Coder

 
Stooshie's Avatar
 
Join Date: Mar 2008
Location: Dundee, Scotland
Posts: 376
Thanks: 9
Thanked 39 Times in 39 Posts
Stooshie is on a distinguished road
It's ok oesxyl, he did earlier.

Quote:
Originally Posted by oesxyl View Post
I'm glad you solve it. Please post the way you fix it for future search on forum. Could help someone Thank you.

regards

Quote:
Originally Posted by mlse View Post
Hi all,

Thanks for your replies! I have no proxy, nor am I using IE ... I've put in a quick fix by getting localhost to redirect to the local IP address.
__________________
Regards, Stooshie
O
Stooshie is offline   Reply With Quote
Old 04-21-2008, 05:08 PM   PM User | #12
oesxyl
Master Coder


 
Join Date: Dec 2007
Posts: 6,682
Thanks: 436
Thanked 890 Times in 879 Posts
oesxyl is a jewel in the roughoesxyl is a jewel in the roughoesxyl is a jewel in the rough
Quote:
Originally Posted by Stooshie View Post
It's ok oesxyl, he did earlier.
Thank you, and I'm sorry, some times I'm dumb, I read the post but don't get the message,

regards
oesxyl is offline   Reply With Quote
Old 04-22-2008, 02:02 PM   PM User | #13
mlse
Regular Coder

 
mlse's Avatar
 
Join Date: Mar 2005
Posts: 624
Thanks: 20
Thanked 19 Times in 18 Posts
mlse is on a distinguished road
Lol! Anyway, it looks like that's going to be a permanent fix now rather than a quick fix!
mlse is offline   Reply With Quote
Old 04-22-2008, 02:20 PM   PM User | #14
Stooshie
Regular Coder

 
Stooshie's Avatar
 
Join Date: Mar 2008
Location: Dundee, Scotland
Posts: 376
Thanks: 9
Thanked 39 Times in 39 Posts
Stooshie is on a distinguished road
Just realised mlse, I said "he". I hope I wasn't making assumptions.
__________________
Regards, Stooshie
O
Stooshie is offline   Reply With Quote
Old 01-27-2009, 01:56 AM   PM User | #15
Beaudoin
New Coder

 
Join Date: Nov 2002
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Beaudoin is an unknown quantity at this point
I'm having the same problem as mlse, but I've tried everything I could find on the internet to solve my permissions problem with no success.

I'm using Windows XP Pro SP2 (32 bit, IIS 5) and I've tried the following:

The above suggestion of making localhost a trusted site;
  1. I made sure that my localhost is a trusted site (as suggested above);
  2. Tried to use my own IP address instead of localhost;
  3. I set my folder to be Shared and allow other users to change my files;
  4. I made sure my folder was set with full permissions to everyone (as suggested here;
  5. In IIS, I checked Anonymous login and made sure that the login is my username;
  6. Shared the folder, and also set it shared to internet users;

...and I still can't save files using an upload form. I keep getting an access denied error. I know that it's my own machine because my script works fine in other environments. Did I miss anything?
Beaudoin is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:12 PM.


Advertisement
Log in to turn off these ads.