I have a javaScript that calls a function:
var combineddata = jQueryGetHtml();
The function is:
// Get ALL of the HTML using jQuery
var jQueryGetHtml = function()
{
var htmlStartTag = function()
{
return $('html').contents();
var attrs = $('html')[0].attributes;
var result = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html';
$.each(attrs, function() {
result += ' ' + this.name + '="' + this.value + '"';
});
result += '>';
return result;
}
return htmlStartTag() + $('html').html() + '</html>';
}
This works great except that it strips out inline javascript such as:
<script type="text/javascript">
var addthis_config = {"data_track_clickback":true, "ui_click":false};
</script>
Another problem: This div
<div id="Pc8od0kc" class="reusable-block">
<a href="http://www.addthis.com/bookmark.php?v=250&amp;username=somebody" class="addthis_button">
<img width="125" height="16" style="border: 0pt none;" alt="Bookmark and Share" src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif">
</a>
<script type="text/javascript">var addthis_config = {"data_track_clickback":true, "ui_click":false};</script>
<script src="http://s7.addthis.com/js/250/addthis_widget.js#username=claremontmc" type="text/javascript"></script>
</div>
becomes
<div id="Pc8od0kc" class="reusable-block">
<a class="addthis_button" href="http://www.addthis.com/bookmark.php?v=250&amp;username=somebody">
<img src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif" alt="Bookmark and Share" style="border: 0pt none;" height="16" width="125">
</a>
</div>