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, 2022 in Java by Soham
• 9,710 points
8,842 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,680 points
2,054 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
3,964 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
11,323 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
5,295 views
0 votes
0 answers

Javascript - Window open, use CDN

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

Jul 20, 2022 in Web Development by gaurav
• 23,260 points
447 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, 2022 in Java by Rahul
• 9,680 points
11,762 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, 2022 in HTML by Ashwini
• 5,430 points
672 views
0 votes
0 answers

jQuery Toggle Fahrenheit/Celsius

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

Jul 22, 2022 in Web Development by gaurav
• 23,260 points
365 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, 2022 in Java by Aditya
• 7,680 points
1,209 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP