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

Bugs will be moved here once resolved.

Post » Wed Nov 30, 2011 10:05 pm

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
B
12
S
2
G
5
Posts: 73
Reputation: 3,570

Post » Wed Nov 30, 2011 11:34 pm

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?
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518

Post » Thu Dec 01, 2011 4:11 am

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.
B
12
S
2
G
5
Posts: 73
Reputation: 3,570

Post » Thu Dec 08, 2011 6:33 pm

Are there any browser errors?
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518

Post » Fri Dec 09, 2011 3:49 pm

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: http://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: http://static.ak.fbcdn.net/rsrc.php/v1/yp/r/0qp7B94K1gf.css
Line: 85

Warning: Unknown property 'border-top-right-radius'. Declaration dropped.
Source File: http://static.ak.fbcdn.net/rsrc.php/v1/yp/r/0qp7B94K1gf.css
Line: 383

Warning: Unknown property 'zoom'. Declaration dropped.
Source File: http://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.
B
12
S
2
G
5
Posts: 73
Reputation: 3,570

Post » Fri Dec 09, 2011 3:54 pm

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.

B
12
S
2
G
5
Posts: 73
Reputation: 3,570

Post » Sat Dec 10, 2011 6:23 pm

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 ?

thx!
B
12
S
2
G
5
Posts: 73
Reputation: 3,570

Post » Sat Dec 10, 2011 8:22 pm

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)

New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Sat Dec 10, 2011 10:12 pm

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: *');vtrix2011-12-10 22:14:42
ImageImage
B
61
S
19
G
6
Posts: 809
Reputation: 9,028

Post » Mon Dec 12, 2011 4:06 am

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 !
B
12
S
2
G
5
Posts: 73
Reputation: 3,570

Next

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest