View webpage source using javascript
If you wanna see your webpage source using javascript here is a simple example just copy and paste the script below to your webpage and press the View Source button.
<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>
This script will work on Mozilla and Chrome. IE hate this script![]()
Related posts:
- Displaying Text from User On Your Webpage
- Add to favorites or bookmarking using javascript in firefox and internet explore [IE]
- Change webpage background color using javascript
- Password protect pages using javascript
- Javascript Popup Chromeless Window
- PHP is not executed and source visible
- Words Validation with Javascript
