NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming > CODE
Reload this Page JavaScript: Allow your visitors to View the Source Code of Web Pages from your site

CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here.

Advanced Search
7 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 09-07-2003, 04:15 PM THREAD STARTER               #1 (permalink)
Senior Member
Join Date: Aug 2002
Posts: 1,255
deadserious has a spectacular aura aboutdeadserious has a spectacular aura about
 



JavaScript: Allow your visitors to View the Source Code of Web Pages from your site


This code allows your visitors to type any url in a text box and will attempt to retrieve the source code. View example: http://www.webdesigntalk.net/tools/viewsource.html

Add this to the head section of your page:
Code:
<script language="JavaScript" type="text/javascript">
<!-- Code by deadserious - http://www.webdesigntalk.net -->

function http(){
    if (document.getsource.view.defaultvalue != document.getsource.view.value)
    {document.getsource.view.value = "View Source"}
    if (document.getsource.url.defaultvalue != document.getsource.url.value)
    {document.getsource.url.value = "http://"}
}
function viewSource(){
    document.getsource.view.value="One Moment Please"; 
    var geturl = document.getsource.url.value; {
    var SourceUrl = "view-source:" + geturl ; location.href = SourceUrl;
    }
}

</script>
Add this to the body section of your page:
????: NamePros.com http://www.namepros.com/code/15219-javascript-allow-your-visitors-view-source.html
Code:
    <form name="getsource" action="">
      <b>URL:</b> <input type="text" name="url" onfocus="http()"
      value="http://" /> <input type="button" name="view"
      value="View Source" onclick="viewSource()" />
    </form>
deadserious is offline  
Old 09-07-2003, 04:22 PM   #2 (permalink)
NamePros Regular
Join Date: Jun 2003
Location: California
Posts: 245
Alpha is an unknown quantity at this point
 



Whoa that's cool! Thanks for posting it deadserious!
__________________
--Alpha
Alpha is offline  
Old 12-19-2003, 02:40 AM   #3 (permalink)
New Member
Join Date: Dec 2003
Posts: 11
Daniel Smith is an unknown quantity at this point
 



Nice script.

but who is gonna use it?
Daniel Smith is offline  
Old 12-19-2003, 03:17 AM   #4 (permalink)
NamePros Member
 
Mp)Tarh's Avatar
Join Date: Aug 2003
Location: Ontario, Canada
Posts: 98
Mp)Tarh is an unknown quantity at this point
 



I used it on my new website. Except I modified it to:

<A HREF="javascript:window.location.replace('view-source:' + window.location + '');">view my source</A>

Very usefull.
__________________
Yeah... I knew that. What?
Mp)Tarh is offline  
Old 12-29-2003, 07:46 PM   #5 (permalink)
Senior Member
 
Crusader's Avatar
Join Date: Aug 2003
Location: Canada
Posts: 1,257
Crusader is just really niceCrusader is just really niceCrusader is just really niceCrusader is just really nice
 



Quote:
Originally posted by Daniel Smith
Nice script.

but who is gonna use it?
people who are trying to see the source but are being barraged by right click protection popups?
Crusader is offline  
Old 12-29-2003, 10:11 PM   #6 (permalink)
NamePros Regular
 
CreativeLogic's Avatar
Join Date: Sep 2003
Posts: 889
CreativeLogic has a spectacular aura aboutCreativeLogic has a spectacular aura about
 



I could def. use that. I didn't know that was possible!

Thanks!
__________________
Online Time Tracking :)
CreativeLogic is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 02:26 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger