Cannot open local file - Chrome Not allowed to load local resource

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 in Java by Soham
• 8,730 points
28 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 by Aditya
• 7,280 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 in Java by Rahul
• 8,980 points
137 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,900 points
2,208 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,630 points
5,762 views
0 votes
1 answer

How can we add local .jar file dependency to build.gradle file?

You can refer the below code if ...READ MORE

answered Jun 27, 2018 in Java by Akrati
• 960 points
4,222 views
0 votes
1 answer

window.location.href and window.open () methods in JavaScript

To answer your question, first of all, ...READ MORE

answered Feb 9 in Java by Rahul
• 8,980 points
1,228 views
0 votes
1 answer

Presenting docket dtates inside html page by javascript

Use the Docker Engine Api:Docker Engine API ...READ MORE

answered Jun 20, 2018 in Docker by DareDev
• 6,890 points
211 views
0 votes
1 answer

Migrating proxy npm repo in nexus 3

I don't think you can achieve this ...READ MORE

answered Jun 22, 2018 in DevOps Tools by DareDev
• 6,890 points
792 views
+1 vote
1 answer

What is the difference between JavaScript and Java

This quote rightly explains that 2 totally ...READ MORE

answered Jun 29, 2018 in Java by Daisy
• 8,120 points
241 views
0 votes
1 answer
0 votes
1 answer

'mvn' is not recognized as an internal or external command, operable program or batch file

 While I was solving this problem, the ...READ MORE

answered Feb 17 in Java by Aditya
• 7,280 points
161 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP