+ 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.!!!
4 ответов
+ 2
I put it into the body as the last since I want my html elements to be loaded first
+ 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.
+ 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>
+ 1
It can be placed between <head> and <body>