导航菜单
首页 >  not allowed to load local resource  > How to Fix 'Not allowed to load local resources' error in Chrome?

How to Fix 'Not allowed to load local resources' error in Chrome?

The error “not allowed to load local resource” in Chrome’s console window occurs primarily when the browser application fails to upload an image, CSS file, or script. This issue arises when a webpage in Chrome attempts to load a resource from the local file system using a different domain or protocol. Although there can be several reasons for encountering this error, Chrome’s security restrictions are often the main cause.

There are various other factors that can cause users to encounter the “not allowed to load local resource” error. These include an outdated host cache, cross-origin resource sharing, and file path or URL issues.

To help you address this error, we have prepared an extensive guide outlining the possible causes of the issue and offering detailed solutions for each one.

1. Disable Chrome security settings

Disabling Chrome’s security features can potentially resolve the “not allowed to load resource” error. Chrome has robust security measures by default to safeguard users against malicious activities and unauthorized access to local resources.

However, in specific cases where the error stems from legitimate causes like cross-origin resource sharing or file path issues, temporarily disabling Chrome’s security features can enable successful resource loading. It is crucial to exercise caution and limit the disabling of security features to troubleshooting purposes only, as it may expose the browser and system to potential risks. To disable Chrome’s security settings, follow these steps:

Open Google Chrome on your computer.In the top-right, click on the three-dot menu button.From the dropdown menu, select “Settings.” Click on the “Privacy and Security” section located on the left side of the settings window, and then click on “Security.Now, click on “No protection (not recommended)” under the Safe Browsing section. When prompted to, click on the Turn-off button. Repeat these steps if you want to revert in the future.After making the necessary changes, close the Settings tab.Chrome will now have the security measures disabled as per your modifications.2. Change the DNS settings

DNS settings can be a potential cause of the ‘not allowed to load resource’ error in certain scenarios. When DNS settings have problems like incorrect configurations, misconfigured DNS servers, or DNS resolution failures, they can prevent the browser from correctly resolving the domain name associated with the resource.

Consequently, the browser deems the resource as ‘not allowed to load’ due to its inability to establish a valid connection. Follow these steps to change DNS settings to rectify this error:

Press the Windows + R keys simultaneously to open the run dialogue box.Type “ncpa.cpl” in the Run dialog search box and press the Enter key. This will open the Network Connection window.Select the network adapter you’re using and click on the Properties button as shown in the image below. Select the “Internet protocol version 4 (TCP/IPv4)” and click on the properties button as shown in the image below. Now, Click on Use the following DNS server addresses and enter the following IP addressIn the preferred DNS server, type 8.8.8.8.In the alternate DNS server, type 8.8.4.4.After that, Click on the check mark beside the validate settings upon exit option.  Save the changes.3. Clear the host cache

Clearing the host cache can be an effective solution to resolving the “not allowed to load resource” error. When browsing the internet, browsers store information about websites in their cache to improve loading speed. However, if the cache becomes outdated or corrupted, it can hinder the browser’s ability to fetch and load resources correctly. By clearing the host cache, the browser discards the outdated information and retrieves fresh data, allowing it to properly load the resources and potentially resolve the error.

Open Chrome.In the address bar, paste the following addresschrome://net-internals/#dnsNow, Click on the Clear Host cache button. Relaunch the browser.

Check if the issue’s been resolved, if not continue to the next step.

4. Set up an HTTP server 

Setting up an HTTP server can help resolve the “not allowed to load resource” error in certain cases. Hosting the resources on an HTTP server enables them to be accessed using the appropriate domain and protocol, bypassing the restrictions imposed by the browser. This allows the resources to load successfully, resolving the error and ensuring proper functionality of the web page. Here’s how to do it:

Click here to download the extension. Click on the Add to Chrome button. When prompted to, Click on Add app button.Once installed, open the application. The application can be found at this address “chrome://apps/”Click on the Choose folder button and navigate to your project folder. Click on the URL to run the project.This will definitely resolve your problem.

相关推荐: