File Access Denied in Chrome: Unable to Load Local Resource
In JavaScript, accessing local files directly through protocols like "file://" has been restricted in Chrome versions 52 and above for security reasons. This causes difficulties when attempting to open local images or other resources.
Example:
function run(){ var URL = "file:///C:<pre class="brush:php;toolbar:false">function run(){ var URL = "http://127.0.0.1:8887/C:2.jpg"; window.open(URL, null); } run();
Suggested Solution:
To resolve this issue, one suitable solution is to use a simple and lightweight HTTP server like "Web Server for Chrome". This browser extension allows you to host local files and access them through a web address (e.g., 127.0.0.1:port).
Instructions:
This method allows Chrome users to access local files securely and conveniently without compromising security or usability.
The above is the detailed content of How to Access Local Files in Chrome After File Access Restrictions?. For more information, please follow other related articles on the PHP Chinese website!