How do I get a page's HTML?

0 favourites
  • 4 posts
  • Hi, I want to get a webpage's HTML.

    I tried with AJAX Request URL (webpage's URL) and then get the page's HTML from AJAX.LastData. My problem is it does not always work, for example, it does work with

    AJAX Request: "http://www.nationalgeographic.com/"[/code:2oiybff4] but it does not work with [code:2oiybff4]AJAX Request: "http://www.scirra.com/"[/code:2oiybff4] Anyone got a clue?
  • Hi, I want to get a webpage's HTML.

    I tried with AJAX Request URL (webpage's URL) and then get the page's HTML from AJAX.LastData. My problem is it does not always work, for example, it does work with

    AJAX Request: "http://www.nationalgeographic.com/"[/code:3640r9pw] but it does not work with [code:3640r9pw]AJAX Request: "http://www.scirra.com/"[/code:3640r9pw] Anyone got a clue?
    

    It's because that's what they've set on their servers.

    "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'yourIP:50000' is therefore not allowed access."

    If you set "Preview browser" to "NW.js", it will work because it will run as an app locally. Similar story will be present when exporting – I'm pretty sure if you export to HTML5 and upload to your server, it won't work. However, NW.js and Androdid export should work.

    When previewing in Chrome, there is one trick you could try – disabling this warning. Make sure only to use this when testing, not when browsing normally, because it could potentially be dangerous.

    If you open cmd at the install directory of Chrome and type in the following code, Chrome will open with the warning disabled:

    chrome.exe --disable-web-security --user-data-dir[/code:3640r9pw]
    (make sure you close all Chrome instances before that)
    
    After you're done with testing, closing all Chrome instances will revert Chrome back to normal mode.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ChesVCF I tried this awhile ago aswell this could be quite a cool tool to use.

  • grigrizljac

    Wow that was extremely helpful. Thank you for your reply I have no problem with it as I want to export to Android, but I will try with NW.js or disabling this warning in Chrome while I am previewing my app.

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