Skip to content

Instantly share code, notes, and snippets.

@bayleedev
Created January 28, 2013 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bayleedev/4660333 to your computer and use it in GitHub Desktop.
Save bayleedev/4660333 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML>
<html>
<body>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script type="text/javascript">
document.parentWrite = document.write;
document.writeCounter = 0;
document.write = function(data) {
var id = 'writeCount' + String(this.writeCounter++);
this.parentWrite('<span id="' + id + '"></span>');
jQuery(document).ready(function($) {
$('#' + id).after(data);
});
}
</script>
<div class="adSpace">
<script type="text/javascript" id="adServerBS">
var foo = "<sc" + "ri\"+\"pt>alert('foobar');</s\"+\"cr" + "ipt>";
document.write("<sc" + "ript>document.write(\"" + foo + "\");</scr" + "ipt>");
</script>
</div>
</body>
</html>
@loriopatrick
Copy link

What's the point of breaking up "script" "<sc" + "ript>...? Is it just an IDE parsing/syntax workaround or is there something else to it?

@bayleedev
Copy link
Author

@loriopatrick I was trying to emulate some of the weird things that the ad service is doing. I split up "script" into multiple segments because the browser had issues parsing it, I didn't investigate it more since I didn't care about the emulation aspect of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment