: What's the deal with URLs for Yandex.Metrica not prepended with "http"? The description of Yandex.Metrica explicitly says that URLs like //mc.yandex.ru/metrika/watch.js (no http: in front) that the
The description of Yandex.Metrica explicitly says that URLs like //mc.yandex.ru/metrika/watch.js (no http: in front) that the web site owner has to insert into his pages are not erroneous. So for example this code:
<img src="//mc.yandex.ru/watch/00000"
style="position:absolute; left:-9999px;" alt="" />
is claimed to be okay.
However the code validator thinks such URLs are not okay and I'd rather make the validator happy so that noone breaks the code later trying to "fix" it.
Why are these URLs not prepended with http:? What happens if I actually prepend them with http:?
More posts by @Jennifer507
1 Comments
Sorted by latest first Latest Oldest Best
I think the code validator is wrong. If part of a URL is missing then the other parts are filled in from the parent page. So for example, if an image is referred to from example.org/page1.html with src="pic.jpg" then the browser adds example.org/ before the src.jpg before it fetches the file. If the http: part of the url (the protocol) is missing then the protocol on the parent page will be used.
Why are they not prepended with http:? I'm guessing it's because if you have an page then the images will automatically be delivered via https.
If you actually prepend them with http: and you have an https page then, depending on the browser, the user may get an error message saying that some of the content on the page isn't secure.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.