Answer the question
In order to leave comments, you need to log in
Where can I find any information on the javascript and data protocols?
I often met similar parts of the code and the last time I saw it on Wikipedia:
A typical example would be a link <a href="javascript:DoSomething()">
. Even if the forum allows external links, the javascript: and data: protocols should not be allowed .
Answer the question
In order to leave comments, you need to log in
For example, you have a 20-byte image. You feel sorry for the server (since each image is a separate request), so you just insert it directly into the html. An increase in the html file by 20 bytes is imperceptible, and the absence of an extra request is nice. It's the same with scripts. That is, this is a pseudo-protocol that allows you not to go anywhere, but to take information about external resources directly from the HTML content.
But in practice it is rarely used, since there are more advanced techniques, and there are many shortcomings.
it's just calling a JS function by clicking on a link. I mean don't filter links starting with javascript: and data:
They are not protocols, but URI schemes . data is official, javascript is not.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question