Search code examples
javascriptjqueryjspfirebugchromebug

How to prevent a text from appearing up in firebug or View Source of browser


I have a simple Pan card no : xxxxxxx7654 , which i am showing using jsp in the browser. Now , if i use the view source functionality of the browser or the firebug tool or chrome bug tool, then i will be able to see the text in the DOM. Now, I want to get the text displayed in browser, but want to hide it from prying eyes of people who will be using fire bug, chrome bug or View Source of a browser .

The field name is PAN_CARD_NO.

I display it using : <p id ='My_Pan'>My Pan is :<%= PAN_CARD_NO %></p>

Now this brings the value in the browser, which is nice and dandy, but i don't want it to be shown using fire bug or chrome bug or view source.

Does any body have any suggestions as to how it can be done ?


Solution

  • The source of the page is what is delivered to the browser to be rendered. Because of that, anything that you want to present to the end user in the browser will be visible in some way in the source code. There are no work-arounds here. If it is displayed in the browser, the end user has access to it in one way or another.

    If your goal is to not show the whole PAN card number, that should be done on the server side, before it's delivered to the browser. In this case, you make sure that the PAN_CARD_NO variable only contains something like xxxxxxx7654. With this method, full PAN card number is never delivered to the end user.

    If your goal is to prevent unauthorized users from viewing the PAN card number, then you need to make sure that you only deliver the card number for the authenticated user. This will require you to have the user authenticate themselves to the server in some way (e.g. logging in).