?
Solved

java programming

Posted on 2006-04-11
6
Medium Priority
?
253 Views
Last Modified: 2010-04-17
1.How to disable save as option of any browser in JavaScript ?
2.How to disable source option of any browser in JavaScript?
0
Comment
Question by:krisdev
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
nayernaguib earned 672 total points
ID: 16433444
1. This is *impossible*.
2. This is *impossible*.

:-)

The browser cannot render a web page unless it is already locally saved in the some temp. folder. This means that if you can view a page in a web browser, then you already have it!

The best you can do is hide the menu bar and disable the context menu using some JavaScript code, but users can still go to the cache folder and view/edit/copy the web page.

_______________

  Nayer Naguib
0
 
LVL 6

Assisted Solution

by:avinthm
avinthm earned 664 total points
ID: 16433456
0
 
LVL 14

Expert Comment

by:nayernaguib
ID: 16433470
Moreover, if you use the JavaScript code that disables the right-click context menu, users can choose not to run JavaScript code, which disables this feature. There are also other tricks, such as pressing F10 while viewing a page with Internet Explorer to enable the context menu.

Hiding the menu bar is also not so effective. Copying and pasting the contents of the Address bar into a new window is one workaround.

_______________

  Nayer Naguib
0
 
LVL 10

Assisted Solution

by:jagadeesh_motamarri
jagadeesh_motamarri earned 664 total points
ID: 16447939
Source Padding
Really, the oldest trick in the book. It involves adding a ton of white space before the start of your code so that the view source menu appears blank. However, must all people will notice the scroll bars and will scroll around to find your code. As pointless and silly as this method is, there are some still who use it.

No Right Click Scripts
These scripts stop users from right-clicking, where the "View Source" function is located.

Cons:

    * Notoriously hard to get working across browsers and to actually work properly.
    * The right-click menu, or context menu, includes many helpful tools for users, including navigation buttons and the "Bookmark Page" button. Most users don't take kindly to having their browser functionality disabled and are inclined not to revisit such pages.
    * The View Source function is also available through the top Menu. At the main menu bar at the top of your browser, select View, and then in the sub-menu, you'll see "View Source" or something similar. Also, there are keyboard shortcuts like Ctrl+U that can be used to view source. All this method does is add about a two second delay to someone trying to view your source and it does irritate users who aren't trying to view your source.


"JavaScript Encryption"
This is by far the most popular way to try to hide one's source code. It involves taking your code, using a custom made function to "encrypt" it somehow, and then putting it in an HTML file along with a function that will decrypt it for the browser. A User is able to view the source, however, it isn't understandable.

Cons:

    * Your website is only usable for users with JavaScript enabled. This rules out search engines, users who've chosen to disable JavaScript, and users using a textual browser (such as the blind) that doesn't have JavaScript capabilities. Remember, JavaScript is a luxury, not a necessity on the web.
    * You have to include a means of decrypting the page so the browser can display it. Someone who understands JavaScript can easily decrypt the page.
    * Many browsers provide alternative ways around this. Some, like Netscape 7.0, allow you to save the page, decrypted for easy viewing later. Others, like FireFox, include tools like the DOM Inspector, which allows you to easily view and copy the XML of the page, decrypted.


HTML Protection Software
There are some less than honest people who want to sell your software to quickly and conveniently "protect" your source code. This type of software generally employs the above methods, in varying ways, to hide your source code. Many people think that if they are buying it, it must work. It doesn't. As we've seen, the above methods are all easily circumvented, and all this software does is implement these horribly flawed methods for you and take your money. Don't fall for them, I've yet to see a single one that's worked, and they never will.

Isn't there Any Hope?
The bottom line is that browsers need to see the unencrypted, plain text source code to create a webpage. For that reason, it's impossible to hide your HTML source code. If the browser can read it, which it needs to be able to do to render a webpage, then so can a user. That's the bottom line.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Screencast - Getting to Know the Pipeline

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question