How to add a javascript embed code which is used for embedding into other website.

It is inevitable that to add some javascript code which copy from other web service, like google analytics. So I get  a question when I saw the code, why it always like (function(){ xxxx })(); After thinking on this a little bit, I realized the reason. That because, when you embed several lines of code into other web page, you don't what kind of global or local variables there are, so you need to create a your own block which won't affected by other javascript variables. That's it.
blog comments powered by Disqus