- World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.

Get it now !!
Send your Resume to 6000 Companies

Search Interview Questions

Question: How can you disable the browser to view the code?

Answer: Writing codes within the <! -- //-- > Tag.

Category ASP Interview Questions & Answers - Exam Mode / Learning Mode
Rating (0.3) By 6209 users
Added on 10/24/2009
Views 66785
Rate it!
Question: How can you disable the browser to view the code?

Writing codes within the <! -- //-- > Tag. Source:

well we can use Querystring to secure our page...... from unauthorized person Source:

Answered by: Rupinder sethi | Date: | Contact Rupinder sethi Contact Rupinder sethi

Use of <!-- ... --> makes no sense these days. I prefer to hide menu bar, address bar and disable right-click, if you really dont want the user to show your code.

Answered by: Priyank | Date: 11/12/2009 | Contact Priyank Contact Priyank

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


* 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.


* 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.

Answered by: praveen | Date: 11/29/2009 | Contact praveen Contact praveen

var isnn,isie
if(navigator.appName=='Microsoft Internet Explorer') //check the browser
{ isie=true }

{ isnn=true }

function right(e) //to trap right click button
if (isnn && (e.which == 3 || e.which == 2 ))
return false;
else if (isie && (event.button == 2 || event.button == 3))
alert("Sorry, you do not have permission to right click on this page.");
return false;
return true;

function key(k)
if(isie) {
if(event.keyCode==17 || event.keyCode==18 || event.keyCode==93) {
alert("Sorry, you do not have permission to press this key.")
return false;

alert("Sorry, you do not have permission to press this key.")
return false; }

if (document.layers) window.captureEvents(Event.KEYPRESS);
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);

Put this code in a file called security.js and reference it between the <HEAD> and </HEAD> tags of any html or asp page using: <Script language="JavaScript" src="security.js"></script> Source:

Answered by: Srinivasan Baskaran | Date: 6/5/2010 | Contact Srinivasan Baskaran Contact Srinivasan Baskaran

We can use this <!----- >

Nicku Source:

Answered by: nicku | Date: 8/13/2010 | Contact nicku Contact nicku

If you have the better answer, then send it to us. We will display your answer after the approval

Rules to Post Answers in

  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.

Post your answer here

Inform me about updated answers to this question.
Related Questions
View Answer
How does the server identify and execute the server-side scripts within HTML code?
View Answer
How can you change the primary scripting language for a page?
View Answer
What is the order of execution for an ASP application?
View Answer
What are the tasks performed by <FORM> tags?
View Answer
What are the attributes of the <FORM> tags? What are their functions?
View Answer
What are the tags necessary to be present within the <FORM> tag?
View Answer
What is Querystring collection?
View Answer
What is a Form collection?
View Answer
What is the difference between Querystring collection and Form collection?
View Answer
What is Cookies collection?
View Answer
What is the difference between Cookies collection and Form/Querystring collection?
View Answer
What is ServerVariables collection?
View Answer
What is ClientCertificate collection?
View Answer
What are the event handlers of Session Object?
View Answer
What are the advantages of Cookies over Session Object?
View Answer
How will you delete a Cookie?
View Answer
What is Server Object?
View Answer
What is a TextStream object?
View Answer
What is an Err Object?
View Answer
What is Extranet?
View Answer

Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here - Best Freshers & Experienced Jobs Website.

View All ASP Interview Questions & Answers - Exam Mode / Learning Mode

India News Network
Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
Cache = 0.03125 Seconds