[R70] Ajax request doesn't work (Chrome/Mozilla)

0 favourites
  • 11 posts
From the Asset Store
High quality sound effect pack, in the following categories: Garden work, tools
  • Hi,

    I didn't really investigate, first I wanted to know if you had any known problems with Ajax and Mozilla.

    I have a game that works fine with chrome, but, the same game, with mozilla, give me an Ajax Error.

    Thanks !

    Firefox 8.0.1

  • What error exactly?

    The server sending the AJAX request needs to send the

    Access-Control-Allow-Origin: *

    HTTP header to allow cross-domain AJAX requests. Could that be the problem?

  • actualy... I don't know what it is...

    I recognize the Facebook user by his name.

    And then I look up his name in my database SQL to retrieve some data, with Ajax Request.

    It works fine.

    I have a facebook account with my name.

    With that account, I can use Ajax to retrieve information on the SQL, with Chrome, IE and Firefox without pb.

    I have another Facebook account, with that account, I have the Ajax Error.

    Instead of complete, it fails (I don't know what error, it just respond to the On Error).

    In the same time it does the Ajax Request, I display the URL use for the Request in the game. If I copy this URL directly in the explorer, I don't have any error.

    So it's not a pb with firefox...

    It must come from the facebook account...

    I don't really understand it.

  • Are there any browser errors?

  • with firefox 3.6 on mac, yes, and a lot of warnings

    Errors :

    Error: uncaught exception: [Exception... "Not enough arguments" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: http://thenarrativcom.fatcow.com/games/christmasrush/c2runtime.js :: anonymous :: line 121" data: no]

    Error: console is not defined

    Source File: thenarrativcom.fatcow.com/games/christmasrush/c2runtime.js

    Line: 128

    Error: Async statement execution returned with '13', 'database or disk is full'

    Source File: file:///Volumes/Firefox/Firefox.app/Contents/MacOS/components/nsPlacesDBFlush.js

    Line: 312

    and the warnings looks lke :

    Warning: Unknown property 'zoom'. Declaration dropped.

    Source File: static.ak.fbcdn.net/rsrc.php/v1/yp/r/0qp7B94K1gf.css

    Line: 85

    Warning: Unknown property 'border-top-right-radius'. Declaration dropped.

    Source File: static.ak.fbcdn.net/rsrc.php/v1/yp/r/0qp7B94K1gf.css

    Line: 383

    Warning: Unknown property 'zoom'. Declaration dropped.

    Source File: static.ak.connect.facebook.com/connect.php/en_US/css/bookmark-button-css/connect-button-css/share-button-css/FB.Connect-css/connect-css

    Line: 156

    but there is a lot...

    maybe firefox 3.6 doesn't support well html 5

    my game doesn't even load, it's still a white screen.

  • And on Safari 4.1.3 on Mac (with Mac OS X (10.4.11) so a little bit old....)

    It just failed to load the ressources with the Request Ajax command.

    The same code, same Url that works on PC with any other explorer.

  • I have a little bit of an answer maybe...

    I made the game to work on Facebook.

    And facebook require HTTPS links.

    That's what I did.

    So my AJAX Request are with the https link.

    BUT, if someone is connected to facebook NOT in https, then the Request doesn't work.

    basicaly, you have to be in Https to have https request that works.

    being in http and make a https request will fail.

    Also, being in https and making an http Request will fail.

    maybe that's obvious for you, but i just discovered that.

    is there a way to know in what connection is the user ?

    get the Url, maybe ?


  • You can get the url through the Browser expression "url". From there, you could check that the first characters are either "http:" or "https".

    Indeed, for AJAX to work on SSL, the page from where the call is made and the target page must both be https.

    I didn't know about the https to http not working, it makes no real sense to me.

    Another thing to take into account is cross-domain incompatibilities.

    Your ajax call has to be made from the same domain as the target. (to confirm)

  • hmm strange, i connected an app in facebook yesterday without having needed https, runs on regular http, have you tried just with inserting http ?

    edit: i also do ajax requests to php server

    i did put this in my connection file

    header('Access-Control-Allow-Origin: *');

  • well, i'm not a real expert...

    I know that facebook need the app to be in https.

    If the user is in https and you app is in http.

    it ask the user if he wants to go in http. and I don't want that.

    So, i needed to have the ajax call in https too.

    where do you put the "header" thing ?

    And what does it means, or do ?

    thx for the answer !

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • header('Access-Control-Allow-Origin: *');

    you put this at the top of the php file where you do your server connection

    im just saying i didnt need the https to add my app to facebook so i dont need https ajax call...

    i just followed the facebook c2 tutorial

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)