This is a completely anonymous object ... if so, how do you access it?

Possible duplicate:
What does script-tag mean with src and content?

I was just browsing this page on how to implement the Googles +1 button. When one implementation (parsing) 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 wrong.

If so, how can one access this seemingly anonymous object? After writing this question, I suddenly realized that maybe this can be done with DOM parsing, but it seems pretty funny.

So is this an anonymous object? And if so, how is this anonymous object used? Is this some familiar technique that I don’t know about?

Or am I just completely misinterpreting the code, and isn't this an anonymous object?

+6
source share
1 answer

This is a hack.

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

JS tries to find its own script element and then extract the content from it (perhaps via innerHTML , but I have not tested it) and parse it.

0
source

Source: https://habr.com/ru/post/896204/


All Articles