Get Object not working

Bugs will be moved here once resolved.

Post » Sun Oct 02, 2016 12:59 am

When using the get object to retrieve a text file located on the internet it does not retrieve the text file.

Could not figure out how to upload a Capx file to this post so yo can find one here: http://www.bluefiregames.com/temp/getExample.capx.

The Capx will simply try to download a .txt file and change the text string (which is "starting text") to the contents of the text file.
You can find the text file here: http://www.bluefiregames.com/temp/message.txt
You can also find a copy of the crossdomain.xml file here: http://www.bluefiregames.com/crossdomain.xml

To reproduce bug:
Step 1: Open the Capx file and press the Run Layout button at the top.
Step 2: Watch what happens.

What happens? The text is not changed.

Expected Result: The text should be changed.

Affected Browsers
Chrome: (YES)
FireFox: (YES)
Internet Explorer: (YES)

Operating System and Service Pack: Windows 10 unknown service pack.

Construct 2 Version ID: release 236
B
18
S
7
G
5
Posts: 62
Reputation: 4,410

Post » Sun Oct 02, 2016 6:52 am

Image

The crossdomain.xml file only works with Flash applications...

Cross-Origin Resource Sharing
Image
B
63
S
23
G
7
Posts: 1,479
Reputation: 10,794

Post » Mon Oct 03, 2016 1:40 am

The requesting web page the game is located on and the target file are on the same domain but in different folders. Should this not be a same domain request instead of a cross domain request.

Where can I find an example showing me how to set up cors for the website?

How do I change the header in the ajax object?

Jason
B
18
S
7
G
5
Posts: 62
Reputation: 4,410

Post » Mon Oct 03, 2016 10:54 am

Closing as not a bug. crossdomain.xml has nothing to do with the CORS standard. The request should succeed if hosted on the same origin, but won't work in preview mode unless you specify the Access-Control-Allow-Origin HTTP header.
Scirra Founder
B
387
S
229
G
87
Posts: 24,245
Reputation: 192,160

Post » Wed Oct 05, 2016 1:32 am

For those interested I finally solved this problem by modifying the .htaccess file on the server by adding the following:

<code>
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Headers "*"
Header set Access-Control-Allow-Headers X-Requested-With
Header set Access-Control-Allow-Credentials true
Header set Access-Control-Max-Age 86400
</IfModule>
</code>

The above code allowed me to use C2 to access the files contained on the server.

Jason
B
18
S
7
G
5
Posts: 62
Reputation: 4,410


Return to Closed bugs

Who is online

Users browsing this forum: BackendFreak and 1 guest