The Data Source

First, we need to specify the source file that we will use to test our side-by-side comparison tool. For this example, we will load in this simple script as a proof of concept:

<h1>test 1 2 3</h1>
<div>this is a test</div>

<iframe src="http://www.yahoo.com" width="100%" height="200px">
   iframes not available
</iframe>

<script type="text/javascript">
   alert("I can alert to you!");
</script>

This mixed HTML/JavaScript markup will simply display a header and div, load an iframe, and then attempt to load an alert message to the user.

What we expect from the cajoled side of the content is the modification of this script to remove the iframe, which can load malicious pages, and display the alert message.

Get Programming Social Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.