Load XML files per AJAX request from local drive

0 favourites
  • 7 posts
From the Asset Store
Per Pixel Destruction like in "Worms" (perfect performance, no third party plugins)
  • Hello there,

    Is there any workaround to request an XML-file from local drive?

    Example:

    paste file path into TextBox: C:\XML_Files\some.xml

    • on click OK button

    -> AJAX request url (TextBox.text)

    • AJAX on completed

    -> Load XML document from string AJAX.LastData

    I tried the above example, it doesn't work - so may be there's some workaround for that. Request from file folder and pasting XML as string will not do in this case.

  • it would be somethin like "file:///C:/filelocation" to open a local file in the browser. No idea if itd actually work tho

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Nope, it doesn't work like this either.

  • JavaScript's access to the file system on the client side is restricted for security reasons. Apparently you can disable this security manually in the browser, but I'd say that's generally not a good idea, and would obviously only work on your system.

    If you want to try though:

    In Chrome you can run the executable with "--disabled-web-security" or "?allow-file-access-from-files" as a commandline argument, Firefox can disable it within it's about:config.

  • Thanks for your help, I tried running executable with this commands, but no with effect. It seems to load something (AJAX "on completed" fires an action), but XML object doesn't load the file. I think I will just paste XML content into the textbox and load it directly into xml object without AJAX call.

  • I'm trying to access XML files too from a local webserver but I can't.

    I can whoever access php files if I declare a access header to the file but I have no idea how to do that with .XML files

    any solution??

  • You cannot load files from disk, because imagine the security nightmare if you could visit a web page and it could read your local files!

    Instead, import any files you want to use as project files, and AJAX request them. See Using project files in Construct 2.

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