no source

JavaScript and client side scripting.

Moderator: General Moderators

User avatar
cheatboy00
Forum Contributor
Posts: 151
Joined: Sat Jun 29, 2002 10:36 am
Location: canada
Contact:

no source

Post by cheatboy00 »

I want to knwo how to make a person not beable to view source... I know theres a way to do it with java script and opening a new window... but i dont want to do it that way i just want people to go to my site and not beable to view teh source

if you have ideas please help
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post by protokol »

I've seen people to crazy things with JavaScript and the ASCII table to encode characters and do all sorts of mathematical functions to screw with the source. So when you view source, you see a javascript function with a bunch of crazy characters where somewhere inside lies the sequence which defines only the characters which are used on your web page.

But honestly, don't go to such lengths. Just move beyond the fact that people will be able to see your source code on your HTML page. Rest assured however that your .php file will be private and not viewable to curious parties who want to steal your code.
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

yeah, chill.. you'll end up like this:

http://www.gotthegeek.com/content.php?article=flash-9
gnu2php
Forum Contributor
Posts: 122
Joined: Thu Jul 11, 2002 2:53 am

Post by gnu2php »

Although there's no way to prevent people from viewing the source 100% of the time--after all, they could go to their "temporary internet files"--there are a couple of preventative measures:
  • 1. Place your page in a frameset, but use only one frame window (the page itself). That way they can't go to "View source" from the View menu to see the source code.

    Code: Select all

    <frameset rows="*" framespacing="0" border="0">
    <frame src="mypage.php" marginheight="0" border="0" framespacing="0">
    </frameset>
    2. Suppress the "right-click" event, so they can't right-click and go to "View source."

    Code: Select all

    function mouse_handler(e)
    &#123;
    	if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false;
    
    	if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3))
    	&#123;
    		alert("Sorry, that isn't allowed.");
    		return false;
    	&#125;
    &#125;
    
    if (document.captureEvents) // Netscape requires this
    &#123;
    	document.captureEvents(Event.MOUSEDOWN);
    &#125;
    
    document.onmousedown = mouse_handler;
fatalcure
Forum Contributor
Posts: 141
Joined: Thu Jul 04, 2002 12:57 pm
Contact:

Post by fatalcure »

have you guys noticed that in this forum, when you click on "POST REPLY", posting.php, you CANNOT view the source??

Im using MSIE 6.x on WinXP, and right click -> view source doesnt work
neither does view -> source on the file menu

just an observation
Tiimmy
Forum Commoner
Posts: 38
Joined: Sat Apr 27, 2002 1:56 am
Location: Australia
Contact:

Post by Tiimmy »

I'm running the same setup, and I can't view it either... Freaky... :twisted: :? :?:
Addler
Forum Newbie
Posts: 9
Joined: Wed Jul 24, 2002 3:59 am

Post by Addler »

I havea few already created Java scripts (By me! mwa hahah Java is my hand!!! Thats why I need PHP help.. I just can't grasp it) if you want them, email me: halo_dreams@hotmail.com - I can give them to you.. they will aid in your hidden source conquest.

However there all right, no matter what if someone wants to see, they will see. There are many ways of getting around it.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Just a question: what's so special about your HTML that needs protecting?

Mac

PS. Javascript is client-side, therefore it can be turned off by a user which will render any Javascript solution completely useless.
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

fatalcure wrote:have you guys noticed that in this forum, when you click on "POST REPLY", posting.php, you CANNOT view the source??

Im using MSIE 6.x on WinXP, and right click -> view source doesnt work
neither does view -> source on the file menu

just an observation

Nor can i.. hows it done?

Someone contact Jason he should know.
User avatar
llimllib
Moderator
Posts: 466
Joined: Mon Jul 01, 2002 2:19 pm
Location: Baltimore, MD

Post by llimllib »

no trouble viewing it in Moz 1.0...I just read the source, and there's no javascript that I saw with the intention of stopping source viewing. Perhaps a bug in IE? If anybody wants to see their javascript I can post the source :twisted:
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Must be a bug - what would be the point in protecting the source code of an open source project :lol: .

Mac
User avatar
llimllib
Moderator
Posts: 466
Joined: Mon Jul 01, 2002 2:19 pm
Location: Baltimore, MD

Post by llimllib »

Wait, but that means you're saying Microsoft might have a bug? Nah, probably those dang open-source hippies put a virus on the page or something. :D
Tiimmy
Forum Commoner
Posts: 38
Joined: Sat Apr 27, 2002 1:56 am
Location: Australia
Contact:

Post by Tiimmy »

If it's a bug then why doesn't it affect any other pages? :roll:
User avatar
llimllib
Moderator
Posts: 466
Joined: Mon Jul 01, 2002 2:19 pm
Location: Baltimore, MD

Post by llimllib »

Could be that something in the javascript throws the rendering engine off, so it won't print the source. Like I said, there's nothing that I saw in the code that causes that behavior intentionally, but I've been more wrong before.

Plus, let's face it, it's fun to say that Microsoft has bugs; it never gets old :P
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

It must have something to do with the frame thingie containing the topic review - I can happily view the source when I go to the edit post bit that doesn't have that review.

If it's not a bug, why would the makers of open-source software try to prevent people looking at the source code of a page? It doesn't make sense, but that's just me (and I've never cared about people being able to 'steal' my source code, by the time they see it it's just a bunch of HTML).

Mac
Post Reply