SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2008
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I enable ajax cross-site scripting?

    Hello guys,

    Does anyone know how I can get cross-site scripting to work without a php proxy?
    I have placed
    Code:
    header('Access-Control: allow <*>');
    in the target php file, located on my localhost for testing, it does send the header, but firefox seems to prevent any response unless it's on the same domain, this is a huge problem.

    I have also placed
    Code:
       http.setRequestHeader("Access-Control-Origin", "*");
       http.setRequestHeader("Access-Control-Allow-Credentials", "true");
    within my ajax request function, but firefox simply won't have it ;(

    I know you can put the following in your firefox prefs.js (doesn't work with firefox 3 and ;leaves you wide open to cross-site abuse, not ideal at all.)
    Code:
    user_pref("capability.policy.default.XMLHttpRequest.open", "allAccess");
    This is really starting to annoy me now, I need to have cross site scripting to send an ajax request from one site to another, and I am the web master of both but firefox is not having it at all, even with the co called special headers.

    Anyone know how to get it to work?
    Thanks

  2. #2
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Firefox 3 note
    This feature is available in Firefox 3, but only to extensions and other privileged code; it is not currently available for web content.
    http://developer.mozilla.org/En/Cros...XMLHttpRequest

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2008
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, but I have already read that and tried it out, but it won't actually work for me, it just sits there saying loading like firefox is ignoring the response unless you point it to a file on the same url as the ajax requesting file itself ;(

    I'm using Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1, does it work for anyone else?

  4. #4
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by adc2008 View Post
    Thanks, but I have already read that and tried it out, but it won't actually work for me, it just sits there saying loading like firefox is ignoring the response unless you point it to a file on the same url as the ajax requesting file itself ;(
    You do realise that the text says that it doesn't work, right? It's a feature which isn't implemented yet. You can't do it.

    In Firefox, you can only make cross-site calls from privileged code, such as extensions or signed scripts. There are a few tricks you can use to circumvent the limitation, such as using a Flash-proxy (Flash has a more liberal cross-site policy), or some sub-domain cantrips

  5. #5
    SitePoint Enthusiast
    Join Date
    Jan 2008
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh, no i didn't, no wonder I couldn't get it to work


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •