Safari and Chrome doesn't evaluate dynamically added [removed] tag at page load

后端 未结 2 1076
清歌不尽
清歌不尽 2021-01-22 02:29

I am writing small JavaScript code which will load external js files at html page loading.

I tested 2 ways.

Case 1: Used document.write to add &

2条回答
  •  有刺的猬
    2021-01-22 02:52

    At the time when your javascript is evaluated, the DOM isn't fully built, the head element is not even finished. You normally cannot access or manipulate the DOM ( getElementsByTagName and appendChild, etc. ) before the HTML page is fully loaded.

提交回复
热议问题