Allow chrome to support local Ajax access

Source: Internet
Author: User

The following is the usage experience written by a chrome user.

Some time ago, chrome and Safari were used to support HTML5 application. During the test, it was found that Chrome's security mechanism did not support local access to Ajax. For example:

Access URL: file: // E:/test.html in Javascript. The Chrome browser reports the following error: XMLHttpRequest cannot load file: // E:/test.html. origin null is not allowed by access-control-allow-origin.

The solution is to convert the HTML5ProgramThe extension of chrome. The extension file name is. CRX.

1. Add a manifest. JSON file under the root directory of the program. The file format is:

{"Name": "demoapp", "Description": "Demo", "version": "0.1", "app": {"launch": {"local_path ": "***. html "}}," Permissions ": [" unlimitedstorage "]}

2. Package the program using chrome. Open chrome, select Tools> extended programs from the Settings button, or enter "Chrome: // extensions/" in the address bar /",

3. Click the extension program to package the HTML program:

4. Drag the packaged extension program to the Chrome browser for installation. After installation, run the program.

This article is from the iteye forum.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.