What does a script-Tag with src AND content mean?

后端 未结 4 761
执笔经年
执笔经年 2020-11-22 06:42

Example from Googles +1 button:



        
4条回答
  •  清歌不尽
    2020-11-22 06:54

    After the script has loaded, it looks inside its own script tag to access its content.

    It will use some code similar to this:

    var scripts = document.getElementsByTagName("script");
    var data = eval(scripts[scripts.length - 1].innerHTML);
    

    Courtesy of John Resig.

提交回复
热议问题