Get Object not working

0 favourites
  • 5 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • 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

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

    Cross-Origin Resource Sharing

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

  • 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.

  • 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

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