开发者

Is this a completely anonymous object... if so, how do you access it? [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Wh开发者_运维技巧at does a script-Tag with src AND content mean?

I was just viewing this page, on how to implements Googles +1 button. When one implementation (parse explicit) showed, among other things, this code:

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

To me this looks like a completely anonymous object, but I could be mistaken.

If it is though, how is it possible to access this seemingly anonymous object? Upon writing this question, I suddenly realized it could probably be done with parsing the DOM, but that seems rather ridiculous.

So, is this an anonymous object? And if so, how is this anonymous object utilized? Is this some familiar technique I am unaware of?

Or am I just completely misinterpreting the code altogether, and is this not an anonymous object at all?


This is a hack.

If a script element has a src attribute, then the child nodes of the script element should be ignored.

The JS attempts to find its own script element, and then extract the content from it (probably via innerHTML but I haven't checked) and parse it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜