Skip to content

Instantly share code, notes, and snippets.

@pingyen
Last active December 11, 2015 05:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pingyen/4553100 to your computer and use it in GitHub Desktop.
Save pingyen/4553100 to your computer and use it in GitHub Desktop.
document.write Hijacking
<div id="target" ></div>
<script>
var google_ad_client = 'ca-pub-1821434700708607',
google_ad_slot = '2826960791',
google_ad_width = 728,
google_ad_height = 90;
(function() {
var w = document.write;
document.write = function(str) {
if(str.substr(0, 5) === '<ins ')
document.getElementById('target').innerHTML = str;
document.write = w;
}
})();
</script>
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" ></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment