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
• 9,150 points
698 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,660 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
• 9,240 points
315 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,342 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
6,837 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,342 views
0 votes
0 answers

Javascript - Window open, use CDN

Simple question. I cannot get a new ...READ MORE

Jul 20 in Web Development by gaurav
• 18,960 points
14 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
• 9,240 points
2,706 views
0 votes
0 answers

How to re-enable right click so that I can inspect HTML elements in Chrome?

I am currently seeing a web page ...READ MORE

Jul 21 in HTML by Ashwini
• 1,160 points
22 views
0 votes
0 answers

jQuery Toggle Fahrenheit/Celsius

I'm trying to create a weather app ...READ MORE

Jul 22 in Web Development by gaurav
• 18,960 points
27 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,660 points
297 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