This may be very simple question. I had a list and I customized its icon by using "document.getElementById(list1).style.listStyleImage='url("file:///D:/proj1/pro%20project/images/plus_icon.png")';
".Here I used a icon which is in D drive to set as list icon. I checked this url and it nicely show the icon in web brawser. But when my web application was run , It shows an error in this line as Not allowed to load local resource:
file:///D:/proj1/pro%20project/images/plus_icon.png
What is the reason for this issue and can please anyone suggest a way to fix this problem?
Thank you.
Asked
Active
Viewed 2.3k times
1

Desi Delite
- 191
- 1
- 2
- 15
-
Is this happening on Chrome? – Haych Nov 29 '15 at 18:01
-
@ Haych yes, can you explain why? – Desi Delite Nov 29 '15 at 18:06
2 Answers
0
I found this link which has a similar problem: https://webmasters.stackexchange.com/questions/53870/cannot-load-local-resource
It basically says that because you are using a local path to a file in your webpage, you're stating that the file exists locally to the client and not on your server. The way that it says to fix it is you should store the file in a directory that's served by your web server, and then use a URL to the file that includes your hostname.
-
Thanks for your answer. Here i also used file URI scheme which is mentioned in the link. But it does not work. I need to run this application only in my computer, That is why I use this method. :( any other idea? – Desi Delite Nov 29 '15 at 18:28
-
-
I have already used triple forward slash.. when I set "file:///D:/proj1/pro%20project/images/plus_icon.png " as url in google chrome brawser then the icon show nicely. But when i put this url into above code, it gives error – Desi Delite Nov 29 '15 at 19:36
-
Sorry, totally misread the slashes. I think this answers your question anyway. http://stackoverflow.com/questions/14052473/go-to-local-url-with-javascript – Haych Nov 29 '15 at 20:14
-
-2
Don't use the full path,
Please find the below url for this url("../images/plus_icon.png")
Now it is work please check it

Dinesh
- 1