Cross-Site (CORS) issue trying to open file from a local folder on Mac.

  • Posted in : unRovr
  • sahil
    Participant

    Hi, when I open the index.html page from the downloaded .zip, it returns a CORS error namely:

    – Access to XMLHttpRequest at ‘<path>’ from origin ‘null’ has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.jquery-3.2.1.min.js:4
    – GET <path> about.html net::ERR_FAILED

    Note that I am directly opening the file from a folder and not localhost, however it should still not give an error unless the local machine is trying to access a third-party URL.

    Could you let me know why is this error occurring and how I can resolve it? If there is any JS that is internally calling an external URL or any other place that cause this issue, please share the steps to address it. Thanks!

    OS: Mac Sierra 10.2
    Browswers: Chrome, Firefox

    ahmetsali
    Keymaster

    Hi, ajax pages can’t be loaded when testing on local due to browser security restrictions, it should work fine when you upload your site to a live server, alternatively, you may use Live Server extension with VSCode for testing on your localhost;

    https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer

    Cheers.

    sahil
    Participant

    Thanks, works fine on localhost!

    ahmetsali
    Keymaster

    you’re welcome ;) please don’t forget to rate the theme on themeforest if you liked it, thanks.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register