Script tag with both external source and body

前端 未结 3 878
日久生厌
日久生厌 2020-12-03 22:18

I just came across this sample code, which has a script tag with both an external source and a body. I assume that this is a clever way to pass some information to the inclu

3条回答
  •  [愿得一人]
    2020-12-03 22:54

    Although browsers are said to ignore the contents of a script element when it has a src attribute, this just means that they don’t process it the normal way (parse and run as JavaScript code). The contents are still stored in the DOM and can be read by a script. The contents could be just about anything then, not necessarily JavaScript code but any data.

提交回复
热议问题