1

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.

Desi Delite
  • 191
  • 1
  • 2
  • 15

2 Answers2

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.

Community
  • 1
  • 1
Haych
  • 932
  • 13
  • 36
  • 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
  • Try a triple forward slash? 'file:///' – Haych Nov 29 '15 at 19:21
  • 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
  • Why not use a relative path? – Haych Nov 29 '15 at 23:55
-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