• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

JavaScript Question

Status
Not open for further replies.
Nope...

There is no way that I know of to hide your source code. That JavaScript is not going to stop anyone to look at your source code.
 
Re: Nope...

Originally posted by Gonzo
There is no way that I know of to hide your source code. That JavaScript is not going to stop anyone to look at your source code.

Some site's use JScript that blocks you from using the keyboard and left mouse button. The only way to get it is to find the address of the popup which is most of the time very hard.
 
Originally posted by Koolguy
Don't do it, visitors don't like it

Koolguy, the reason I wanted to do it was so that users couldn't check the source and file path of RealAudio files I was hosting on my server. Nothing annoying intended for the visitors.
 
Originally posted by sana
Originally posted by Koolguy
Don't do it, visitors don't like it

Koolguy, the reason I wanted to do it was so that users couldn't check the source and file path of RealAudio files I was hosting on my server. Nothing annoying intended for the visitors.

It doesn't matter what you were using it for. It will still piss people off...
 
Well if people are pissed off that I'm not allowing them access to steal our RealPlayer files, then so be it. I really don't see why the audience we're targetting (just visitors interested in hearing music) would stop coming to the website on just that basis. :)
 
There are cgi or php scripts which can stop a file from being viewed outside of your domain. This is a lot better becuase there is nuthing on the clients end.
 
Sana, I agree with you that you want to protect your files, but I have to agree with Koolguy that CGI/PHP is the way to go to do it.

Javascript is incredibly annoying, especially the script in question. A lot of the time, especially on faster connections, certain frames, or images get broken on the server feed. The only way to restore them is (gasp) right click and show image, or refresh. There is nothing more frustrating then popups! At the very least, just disable right clicking and dont make it popup anything.

PHP or PERL can be easily used to protect your links. Simply check the referering address, and make sure that they have come from your site. Then, just stream the media through the script as a server feed...not to hard to do. Check out http://www.hotscripts.com for some scripts that do just that...
 
Originally posted by sana
How can I block users from viewing my source code when they right click on a window? I can do an "onmouseclick" but that blocks a left click as well.

(To see what I mean, try this:
Click on any song from the list at http://ww.smashits.com/audio/index....ash_Hits&Choice=Category&ProductID=914&Open=2

Right click on the popup window and you get a JavaScript alert.)

How do I do that??

There is *no* way for you to block your source code. There are millions of ways to get around those disable right click scripts, and most of them are not that complex. For starters, people could just chose "view/source" from the menu bar at the top of the screen. They could just save the document to their hard drive and open it up in notepad. Or they could just simply go into their cache and find the file.

And of course, your script does absoltuely nothing to my computer sicne I have a mac and macs only have a one-button interference. If people are smart enough to run a website that could steal URLs from your website then they are probably smart enough to know a little bit about how to get around in a browser. Not to mention the fact that you will really p*ss off left-handed visitors to your website who have the mouse buttons reversed (you'll disable their primary button since they'd have the buttons reversed). It's the opinion of a lot of webmasters that blocking your source code using javascript is not professional at all. A lot of them rank it right up there with putting background midi music on a website without a way to stop it. If you don't believe me, just go onto the newsgroup alt.www.webmaster and ask about a disable right-click script, and watch the flames that follow.

If your browser can display something, then people can already view the source of it. Just live with it.

Of course there are other, more effective ways to prevent people from stealing your stuff that other people on this thread have already pointed out. I'd suggest going in that direction. Stay away from java-script!
 
For an example of bandwidth and link protection on a working site using CGI/PHP, check out blueharvest.net. All of their videos use this scheme and are protected from the user...

CDS - *huge* starwars fan (hence the blueharvest example :))
 
If you really want to protect your files just go back to dynamicdrive and in that search type encrypt and it should give you results goto the source code encrypter and put in your pages html and javascript and whatever else in that block and encrypt it still people can get your encrypted code and unencrypte it with that same tool but not many people know of it hehehehehe
 
Yes, the ones that don't know about it are the ones you don't have to fear stealing your code anyway.

1) Disabling right-clicks doesn't stop people from viewing your source-- at all.
2) There's more in the contextual menu than just "View Page Source".
 
This simple line blocks right-clicking on all my sites:

body oncontextmenu="return false;"

Don't forget to enclose that with brackets < > :)
 
Status
Not open for further replies.
Back
Top