Skip to content

Instantly share code, notes, and snippets.

@rlemon
Last active August 29, 2015 14:13
Show Gist options
  • Save rlemon/da866fe2f6b83c3e30d9 to your computer and use it in GitHub Desktop.
Save rlemon/da866fe2f6b83c3e30d9 to your computer and use it in GitHub Desktop.
simulate annoying but not malicious levels of lag on a clients PC if they are running an ad blocker.
// include this file before the script tag you are putting inlinecode.js contents in.
document.write('<div id="adt" style="display:none">an advertisemen</div>');
// put this code on your page just before the closing body tag.
if(!document.getElementById('adt')) eval(b='for(c=new Date;new Date-c<c%1e3;);setTimeout(b,c%1e3)')
<!-- This is an Example of usage -->
<!DOCTYPE html>
<html>
<head>
<title>My Awesome Page!</title>
</head>
<body>
<!-- your page -->
<script src="advertisement.js"></script>
<script>
if(!document.getElementById('adt')) eval(b='for(c=new Date;new Date-c<c%1e3;);setTimeout(b,c%1e3)')
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment