Hi, I have a question. How can something that no one can see the source page?

Stevie_D
—
2014-03-26T09:10:34Z —
#2

danialz said:

Hi, I have a question. How can something that no one can see the source page?

The only way to stop people seeing the source code is not to publish it on your website. While there are ways to make it more difficult for people, they can't stop people who are determined, and they will always have a negative impact on people using your site in one way or another.

Why does it matter if people can see your source code anyway?

ralphm
—
2014-03-26T09:12:27Z —
#3

You could minify it to make it harder to read, but as said, you can't hide it in any practical way. If you think your code is unique, you are probably wrong anyway.

danialz
—
2014-03-26T10:30:56Z —
#4

There is no code that will block the source? I want the code to be trying to lock this page: view-source: siteadress

Javascript can disable right clicks > view source > save as, ETC. The down side is people looking at your source usually know how to disabled JS from their browser.

This practice is highly discouraged, not to mention annoying. There are perfectly valid reasons to right click on websites (menu options for opening in a new tab, coping URLs, printing, translation, spelling, etc).

In any case, you can still get to the source even if right clicking is blocked by Javascript. (for example, in Chrome, click the menu button > tools > view source).

felgall
—
2014-03-27T01:33:00Z —
#10

newrykillz said:

Javascript can disable right clicks > view source > save as, ETC.

Not if you disable JavaScript or set your browser to disallow JavaScript interfering with the right mouse button.

The only part of the web page that is under the control of the site author is the content. The browser owner can override the CSS and JavaScript so the page displays and behaves how they want.

newrykillz
—
2014-03-27T12:35:32Z —
#11

felgall said:

Not if you disable JavaScript or set your browser to disallow JavaScript interfering with the right mouse button.

The only part of the web page that is under the control of the site author is the content. The browser owner can override the CSS and JavaScript so the page displays and behaves how they want.

Hence why I stated "The down side is people looking at your source usually know how to disabled JS from their browser. "

felgall
—
2014-03-27T18:36:39Z —
#12

newrykillz said:

Hence why I stated "The down side is people looking at your source usually know how to disabled JS from their browser. "

But you don't need to disable all of JavaScript to disable "no right click" scripts. Most browsers have an option in their settings that just disables JavaScript's access to interfere with the context menu. You can have that permanently blocked and still allow JavaScript to run.

webcosmo
—
2014-03-27T22:43:17Z —
#13

You could use a base64 encrypt for your pages, im sure people wont bother trying to decrypt it.

felgall
—
2014-03-27T23:27:14Z —
#14

webcosmo said:

You could use a base64 encrypt for your pages, im sure people wont bother trying to decrypt it.

The browser would need to be able to decrypt it in order to be able to display the page - that would give people acess to the decrypted version simply by using a browser to decrypt it.

A huge script just to attempt to turn off a couple of keypresses that can easily be turned back on. The biggest effect that script will have is to slow the loading of the page so that people don't wait around for it to finish loading - unless they simple disable JavaScript for that page so as to not load the unnecessary script.

A suggestion to help improve your visitor's experience of your site would be to get rid of that useless script.

Stevie_D
—
2014-03-28T23:14:26Z —
#17

baronintermedia said:

I used Javascript on my website to prevent ctr + U function :

`

`

Hope it can help

Given that most people view the source code by right-clicking on the page to get the context menu up, or going through the menus, I would be surprised if your script even momentarily stopped more than a handful of people - not to mention the fact that you will then have annoyed them with your petty little script so they will be more determined to find a way round it (which really isn't hard) and then potentially try to sabotage your site, exploit a weakness or just publicise how petty your site management is out of sheer devilment.

There really is NO reason to try to prevent people from accessing your source code. Really. You just can't do it, and the hassle that you cause when you try isn't worth it.

felgall
—
2014-03-28T23:35:43Z —
#18

Stevie_D said:

Given that most people view the source code by right-clicking on the page to get the context menu up

It is just as easy if not easier to press the contextMenu key on the keyboard to bring up the context menu as it is to right click with the mouse.

system
—
2014-03-29T08:00:02Z —
#19

I think encryption is the best solution for this as above said. Its really worth.

Stevie_D
—
2014-03-29T09:37:12Z —
#20

aakkam said:

I think encryption is the best solution for this as above said. Its really worth.

WHY? What good does it do you? Absolutely none. It's just selfish and arrogant.