Is it possible to redirect the page
from view source page
? Thus, once the user opened my view source page
it should redirect them to webpage.

- 3
- 1
- 5
-
1You want to block the user from viewing your source? – Konza Feb 11 '14 at 05:47
-
You mean show the source of a different page? – Barmar Feb 11 '14 at 05:47
-
Thanks for your query. I want to redirect them from my source code page to actual web page. – shalini Feb 11 '14 at 05:49
-
1Why do you want to do that? – Konza Feb 11 '14 at 05:52
-
I want to hide my source page from users. I know it is not possible but if i redirect them to web page it will help me a bit. – shalini Feb 11 '14 at 05:55
-
Quick fix: disable right-click through javascript. But that is easily passed. http://www.htmlgoodies.com/beyond/article.php/3875651/Web-Developer-Class-How-to-Hide-your-Source-Code.htm http://stackoverflow.com/questions/6597224/how-to-hide-html-source I think you should leave it as it is. No harm in someone viewing your HTML source. – Zo Has Feb 11 '14 at 06:02
-
I have disabled right click also Ctrl C, Ctrl V, Ctrl A, Ctrl U. Now i want to redirect the user from Source page to webpage. Is it possible? – shalini Feb 11 '14 at 06:04
-
What do you mean by source-page? Is it 'view source' when your right click or your parent page? – Zo Has Feb 11 '14 at 06:06
-
@shalini: and how do you plan to disable the functionality form a user who can go to `Tools>View Source` or use `firebug`. Such tricks are simply not enough – Shiva Feb 11 '14 at 06:07
-
@shiva: If i can redirect them from my view source page to my webpage then i need not worry about Tools->View Source menu. I know this is not enough but it will help me at least 1%. – shalini Feb 11 '14 at 06:11
2 Answers
You cant hide users from viewing your source. There are ways to prevent rightclick on a page. But that too wont help you. There are other ways to view the source.
Hope this helps.

- 2,143
- 17
- 30
No its impossible to effectively hide the HTML, JavaScript, or any other resource sent to the client.
You can disable the right click
and view source
from a normal user, but then it won't stand a chance in case of a more than average user ( and its not even recommend as it might disable functionality like print etc for a normal user) , as they can always use tools like Firebug.
So the best workaround is still using a server-side scripted
web application to generate your HTML, then your business intelligence / process / code is hidden, provided that people do not have access to browse the actual script file on your server.

- 6,677
- 4
- 36
- 61