Mobile app version of vmapp.org
Login or Join
Jennifer507

: 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

@Jennifer507

Posted in: #Analytics #Html #Metrics #Url

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:?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Jennifer507

1 Comments

Sorted by latest first Latest Oldest Best

 

@Gretchen104

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme