Jump to content

Block web visitors from "View Source"?


Chrisj

Recommended Posts

Not reliably, most modern browsers have other means besides right-click to view the source also, so you can override that aspect at all.  There are ways to modify the right-click menu or disable right-click on the webpage but it's not a universal thing you can consistently control.  If the use simply disabled javascript your attempts to disable would be disabled itself.

Link to comment
Share on other sites

You can do a basic shell of a webpage and then use AJAX (javascript) to load the content. This will make the bulk of your stuff not show up in the viewsource. However it makes your site reliant on javascript to work, and anybody who is determined to see/get the page's sourcecode can quite easily get it from somewhere else besides viewing the source.

 

You should not worry about this sort of thing. There is nothing you can output that can't be found somewhere else, and you can't do anything about it anyways. Instead you should just focus on your server-side validation/security and offering up a great product or service or whatever your site is about.

Link to comment
Share on other sites

You can also just:

 

$ curl http://www.your-domain.top/
The only way to block people from viewing your source is to do this:

 

<?php
exit;
At the start of every script. This effectively blocks anyone from viewing source or anything else for that matter.

 

Another option to block people from viewing source is to change your DNS entry:

your-domain.top A 88.88.88.88
You can change the IP to whatever you like, it really does not matter. It may take a few hours though before they are no longer able to view your source. Though it is more effective then the previous described technique.

 

The third option saves you money to stop people from viewing your source. Simply stop paying your hosting company. And you'll see that after some time, they won't be able to view source. Cost effective, but slow.

Edited by ignace
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.