+ 3

where is the "script"tag typically placed in? b/w the head tag or before the html?!!!

i confused many times please help me.!!!

8th Aug 2019, 7:52 AM
Abdulahi Hassan Adam Kerkey
Abdulahi Hassan Adam Kerkey - avatar
4 ответов
+ 2
I put it into the body as the last since I want my html elements to be loaded first
8th Aug 2019, 7:59 AM
Anton Böhler
Anton Böhler - avatar
+ 2
Traditionally <script> tags are placed inside the <head> tag in an HTML document. But, because a browser stops all rendering of the page while it parses and executes the scripts, it is often placed after the presentational content just before the closing <\body> tags in many pages. This helps to speed up the page render.
8th Aug 2019, 9:52 PM
Glenn
+ 1
Abdul Hai Hasan Adnan You may just use this script at the last tag of your body block: Flow The Step <script type="text/javascript"> var script = document.createElement('script'); script.setAttribute('src', 'http://yourdomian.com/your_script.js'); script.setAttribute('type', 'text/javascript'); document.getElementsByTagName('head')[0].appendChild(script); </script>
8th Aug 2019, 8:19 AM
Sazzadur Rahman Morad
Sazzadur Rahman Morad - avatar
+ 1
It can be placed between <head> and <body>
9th Aug 2019, 9:06 PM
Richard Abraham
Richard Abraham - avatar