Recent Posts

This Post Has Been Viewed 158 Times.

View webpage source using javascript

Posted by admin | Posted in JavaScripts | Posted on 06-01-2010

0

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 :P 
VN:F [1.5.7_846]
Rating: 0.0/10 (0 votes cast)
VN:F [1.5.7_846]
Rating: 0 (from 0 votes)
Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • De.lirio.us
  • Xerpi

Related posts:

  1. Displaying Text from User On Your Webpage
  2. Password protect pages using javascript
  3. Add to favorites or bookmarking using javascript in firefox and internet explore [IE]
  4. Words Validation with Javascript
  5. Disabling right click menu using javascript Enhanced Version
  6. PHP is not executed and source visible
  7. How to close a child window from a parent window using javascript

Write a comment

Spam Protected