I am writing a html
file in which it needs to visit a third-party js
file. The js
file would access other resources using the protocol-less URLs, such as: <img src="//xxx/xx.png..>
. When I upload the html and access the page through the website, the resources could be successfully visited. And the local webserver localhost://
works fine too.
However, if I double-click the html
file and open it with a browser directly, these resources could not be accessed. I checked with Inspect Element
and found the scheme was file://
, and the URL of the resource that third-party 'js' file try to access turns to be something like: file://xxx/xx.png
, which of course couldn't be found.
Since I couldn't modify the third-party js
file, so my questions are:
- Is where any way to specify the scheme manually?
- Or how could I make the resources accessible in this condition?
I checked this answer, it indicates that this might be the drawbacks for protocol-less URL. But I am wondering since the scheme could be detected and set in the URL, it might be possible to set it directly.