Cannot open local file - Chrome not allowed to load local resource angular

0 votes

Test browser: Version of Chrome: 52.0.2743.116

Which is a simple javascript that is used for opening an image file from local like 'C:\002.jpg' as mentioned below:-

function run(){ 
var URL = "file:///C:\002.jpg"; 
window.open(URL, null); 
} 
run();


Could I please get any suitable suggestions?

Feb 18, 2022 in Java by Soham
• 9,730 points
10,610 views

1 answer to this question.

0 votes

To answer your query, start with opening your terminal and type

npm install -g http-server

Following which please Go to the root folder that you want to serve you files and type:

http-server ./


Finally, do read the output of the terminal and for which something with this line will appear:-  http://localhost:8080 will appear.


Everything on there will be allowed to be goten for example:
 

background: url('http://localhost:8080/waw.png');

answered Feb 18, 2022 by Aditya
• 7,680 points

Related Questions In Java

0 votes
1 answer

Failed to load resource: the server responded with a status of 404 (not found)

In order to avoid an error while ...READ MORE

answered Feb 8, 2022 in Java by Rahul
• 9,690 points
2,892 views
0 votes
3 answers

How to check whether a file exists or not in Java?

Using nio we can check whether file ...READ MORE

answered Aug 14, 2018 in Java by Sushmita
• 6,920 points
5,576 views
0 votes
1 answer

How to resolve the error: could not find or load main class?

If you are getting error: could not ...READ MORE

answered May 28, 2018 in Java by Parth
• 4,640 points
12,666 views