Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
198
rated 0 times [  200] [ 2]  / answers: 1 / hits: 19759  / 13 Years ago, wed, june 29, 2011, 12:00:00

Example from Googles +1 button:



<script type=text/javascript src=https://apis.google.com/js/plusone.js>
{parsetags: explicit}
</script>


The script Tag has a src-Attribute and content. What does this mean and how does it work?


More From » javascript

 Answers
5

Different browsers treat this differently. Some run the content only if the src is included without error. Some run it after attempting to include the src script, regardless of success. Since this behaviour is unreliable (and prohibited in HTML5), it should be avoided.



Google isn't relying an any specific behaviour. Since the content is just an object literal (a value), executing it would not actually do anything except cause a silent error. Google's code looks at the contents of the script tag itself, and adjust its behaviour based on that.


[#91432] Tuesday, June 28, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ronaldo

Total Points: 694
Total Questions: 85
Total Answers: 103

Location: Somalia
Member since Mon, Feb 27, 2023
1 Year ago
;