Mystery: How does Google do cross-domain iframe communication? -


When you host a Google Web Search element on a page, a div is made that includes an iframe That's a Google AdSense Ads page. However, if there is no ad for specific query, Google somehow changes the class on your domain to present its div (and iframe) invisible.

They are not using post messages because it works in IE 7. They are not even using piece identifier method, because there is no hash in the URL. So how do they do it?

To see what I'm saying, just put it in a regular HTML page:

   

and then search for "car" (or something else that will definitely be an ad) and then for "wzxv", which has no ads ...

The script is included in your frame, so it can do whatever your page wants. Cross-domain restrictions are counted only for scripts in the iframes referred to things in external scripts from foreign domains. google.load ('search', '1'); Runs in your frame owned by your domain, there is no restriction.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -