Learn free online HTML5, javascript, and jquery Tutorials by Examples

Saturday 17 May 2014

View webpage source using javascript

---------------------------------------------------------
<form action="#" onsubmit="return getsource();">
<input type="submit" value="View Source!" />
</form>
<script type="text/javascript" >
function getsource()
{
 var thesource= "view-source:" + window.location;
 window.open(thesource, 'source_code', 'width=400, height=400, resizable=1, scrollbars=1');
 return false;
}
</script>


--------------------------------------------------------

No comments:

Post a Comment