# Make website copy protected



## mohityadavx (Mar 25, 2012)

How could one make website copy protected like this 

Instructions issued to Examiners will now be disclosed under RTI

I was doing a case law search and accidentally came upon this. I do not get the option to select the text. How could I do this?


----------



## coolpcguy (Mar 25, 2012)

There's some js to disable them


```
document.oncontextmenu = function(){return false;};

document.onselectstart=function(){
	if (event.srcElement.type != "text" && event.srcElement.type != "textarea" && event.srcElement.type != "password") {
		return false;
	}
	else {
	 	return true;
	}
};
if (window.sidebar) {
	document.onmousedown=function(e){
		var obj=e.target;
		if (obj.tagName.toUpperCase() == "INPUT" || obj.tagName.toUpperCase() == "TEXTAREA" || obj.tagName.toUpperCase() == "PASSWORD") {
			return true;
		}
		else {
			return false;
		}
	};
}

document.ondragstart = function(){return false;};
```

Trivial to bypass them.


----------



## Faun (Mar 25, 2012)

Use noscript


----------



## Tech&ME (Mar 26, 2012)

But some browsers will still allow you to copy the contains. This trick works with IE (best).


----------



## dashing.sujay (Mar 26, 2012)

I came across this kind of site for the first time. Any way to bypass them?


----------



## krishnandu.sarkar (Mar 26, 2012)

> Instructions issued to Examiners will now be disclosed under RTI
> 
> In what has come as a relief to the whole Student Fraternity, the Supreme Court has ruled that Instructions issued to Examiners for checking the papers can now be made public after the Examination has been conducted.
> 
> ...



This is the text 

Way : Nothing new..!! As suggested by Faun. Use FF + NoScript


----------



## ajaybc (Mar 26, 2012)

Or you could just press Ctrl + U in Firefox. This will bring up the view source window from where you can copy the text.


----------



## PraKs (Mar 26, 2012)

Correct - Use FF + NoScript

Just dont allow anything in No Script when you visit for the 1st time


----------



## RCuber (Mar 26, 2012)

I used Ctrl+A to select all text.. worked !!


----------



## meetdilip (Mar 26, 2012)

dashing.sujay said:


> I came across this kind of site for the first time. Any way to bypass them?



No script does it easily. Normally I see new versions of Firefox too.


----------



## dashing.sujay (Mar 26, 2012)

Update: Text selection is working normally in opera  !!


----------



## mohityadavx (Mar 27, 2012)

coolpcguy said:


> There's some js to disable them
> 
> 
> ```
> ...


Thanks

And Thanks to everyone else also who gave the methids to byepass it


----------



## Roshan9415 (Mar 28, 2012)

Just disable Javascript in mozilla firefox.go to tool>option and disable javascript.


----------



## nbaztec (Mar 30, 2012)

JS as a protection mechanism, why am I not amused?
Anyone who thinks JS is the way to go for protection *is *a weirdo.

document.onselectstart is assigned a function always returning false, which effectively tells the browser *not* to propagate the event further. Bypassing it is as trivial as reassigning it.
In JS console of the browser

```
document.onselectstart=null;
```
Or on the address bar

```
javascript: document.onselectstart=null;
```
and the document's selection start is reassigned to null.


----------



## dashing.sujay (Mar 31, 2012)

^Its working thanks


----------



## nbaztec (Mar 31, 2012)

```
document.onselectstart=function(){return false;};
```


----------



## dashing.sujay (Mar 31, 2012)

Thanks, already got it from source code! 

One question- there's a text box beside "subscribe". Selection of text is possible there except elsewhere.

I can figure out the following code for barring selection-


```
document.onselectstart=function(){
	if (event.srcElement.type != "text" && event.srcElement.type != "textarea" && event.srcElement.type != "password") {
		return false;
	}
	else {
	 	return true;
	}
};
```

What changes I need to do to stop selection of texts in text box & vice versa ?


----------



## nbaztec (Mar 31, 2012)

```
document.onselectstart=function(){
	return  (event.srcElement.type != "text" && event.srcElement.type != "textarea" && event.srcElement.type != "password");
};
```


----------



## dashing.sujay (Mar 31, 2012)

^Not working.


----------



## nbaztec (Mar 31, 2012)

A textbox is rendered separately by the browser. You can set it to enabled=false.

Edit: Sorry I was barely awake (and busy with work). Wasn't able to think straight.

```
document.onmousedown = document.onselectstart=function(){return false;};   // Kinda hacky but works.
```


----------



## aroraanant (Mar 31, 2012)

Nice thread.


----------



## nbaztec (Mar 31, 2012)

nbaztec said:


> A textbox is rendered separately by the browser. You can set it to enabled=false.
> 
> Edit: Sorry I was barely awake (and busy with work). Wasn't able to think straight.
> 
> ...


Do note that you *cannot* disable content inside iframe/frames using this since it leads to an _Unsafe Javascript Access_


----------



## dashing.sujay (Mar 31, 2012)

^But that's disabling text entering. I just want it to let enter but not select it.
And how's it hacky?


----------



## nbaztec (Mar 31, 2012)

^That ain't possible, since textinput/textarea etc. are rendered by the browser separately and their work *is* to let users select (otherwise known as a label).
Hence the hacky way - to disable mousedown to select textbox.


----------



## dashing.sujay (Mar 31, 2012)

Thanks for your efforts.


----------



## nbaztec (Mar 31, 2012)

No problem


----------

