- Impact
- 66
AJAX "Access is Denied" Error
I am attempted to make a firefox add-on that will send data to an external server (sort of like those stumbleupon and del.icio.us addons) with information about what page you're on. however, i want to do this with ajax rather than with forms. The info is populated with predefined variables and are populated with prompt / other info.
now, my problem is that since i'm trying to send the data to an external server, my ajax keeps returning an "access is denied" error. (i actually spent a really long time figuring that out - firefox didn't give any errors since it was an extension... i eventually had to make a new file of jus the ajax to test it in ie so i could see the exact error.)
i tried changing the chmod of the files on my server to 777 and i still got the access denied error. is there some way to get it to work?
or will i have to like open a new window with a page from my site and let them do their stuff there? (since thats what those social bookmarking sites seem to do... i think... but all of the windows look similar if not the same just a different header, so im not so sure).
thanks
EDIT:
I found the solution at
http://developer.mozilla.org/en/docs/Cross-Site_XMLHttpRequest
All it took was adding:
to my php file that was doing the processing.
However, i believe this only works for the newest browsers, but since I'm writing a firefox addon i can just make it for firefox 3.0+ (since this is what i believe it works on)
I am attempted to make a firefox add-on that will send data to an external server (sort of like those stumbleupon and del.icio.us addons) with information about what page you're on. however, i want to do this with ajax rather than with forms. The info is populated with predefined variables and are populated with prompt / other info.
now, my problem is that since i'm trying to send the data to an external server, my ajax keeps returning an "access is denied" error. (i actually spent a really long time figuring that out - firefox didn't give any errors since it was an extension... i eventually had to make a new file of jus the ajax to test it in ie so i could see the exact error.)
i tried changing the chmod of the files on my server to 777 and i still got the access denied error. is there some way to get it to work?
or will i have to like open a new window with a page from my site and let them do their stuff there? (since thats what those social bookmarking sites seem to do... i think... but all of the windows look similar if not the same just a different header, so im not so sure).
thanks
EDIT:
I found the solution at
http://developer.mozilla.org/en/docs/Cross-Site_XMLHttpRequest
All it took was adding:
PHP:
<?php header('Access-Control: allow <*>'); ?>
However, i believe this only works for the newest browsers, but since I'm writing a firefox addon i can just make it for firefox 3.0+ (since this is what i believe it works on)
Last edited:







