[Resolved] AJAX "Access is Denied" Error

SpaceshipSpaceship
SpaceshipSpaceship
Spacemail by SpaceshipSpacemail by Spaceship
Watch
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:
PHP:
<?php header('Access-Control: allow <*>'); ?>
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)
 
Last edited:
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
I have never worked with Firefox addons.
However, in conventional Browser JavaScript, you may only use Ajax to access a file in that site.

For example, a script on www.bruce.com couldn't open something from www.anothersite.com. Attempting to do so would throw a forbidden error.
(Interestingly enough, even calling http://bruce.com/file.php isn't possible from http://www.bruce.com/script.js. Even the subdomain must be the same.)

Is there a chance that Ajax is not the tool you should be using? You may want to research different methods of Firefox addon data retrieval.


Bruce
 
0
Close
I see. Well, firefox addons are basically XML to make the menus, which call javascript functions with oncommand (aka onclick, etc). so i think the only way to do it would be with javascript... what other ways are there to send data to and from external servers since ajax won't work? i only know th ebasics of javascript, and am no pro.
 
0
Close
Found the solution and edited my first post with the answer for those who might have the same/similar question.

Thanks everyone.
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back