Can I load javascript code using <link> tag?

前端 未结 8 1506
情歌与酒
情歌与酒 2020-12-02 20:20

Can I load javascript code using tag in my website ?

For example I have a javascript file, test.js, which contains the simple

8条回答
  •  春和景丽
    2020-12-02 21:12

    To answer your question directly, no. Not by that method. However I was led to this question while searching a similar issue which lead me to this question. Seeing the answers already supplied which for the most part are correct I went to check syntax on http://w3schools.com/ . It seems that with HTML5 there is a new attribute for for the script elements in html.

    This new attribute allows javascript files to be defered or loaded and executed asynchronously (not to be confused with AJAX).

    I'm just going to leave the link here and let you read up on the details yourself as it is already supplied on the internet.

    http://www.w3schools.com/tags/att_script_async.asp

提交回复
热议问题