Why href for link and src for script

Again, when typing, I read this question , but the other one ... and this also has not been decided yet, since the person who answers is marked as correctly, says it in the end

I do not know a direct answer to your question, but I am also interested in learning about this tag. Searching for an answer will probably include some digging of web archives.

So, the question is simple, why do we use the src attribute for the <script> , but href for the <link> , now it bothers me many times when I include stylesheets and scripts ... why can't it be the same? any specific reason for this?

for example

 <script href="#"></script> <link href="#" /> 

Or

 <script src="#"></script> <link src="#" /> 
+7
source share
1 answer

The link points somewhere through a hypertext link (hence href ). That is why we also use <a href .

A script takes its source from another place and embeds itself in the current page, hence src . Compare <img src

EDIT: Of course, another peer-to-peer answer would be β€œHe just does!”: P

+7
source

All Articles