Monday, April 28, 2008

Script to make Web page unprintable

If you want it to be unprintable, you could stop newbie users from
printing directly from the page by putting:

<style type="text/css" media="print">
body { display: none }
</style>

Between the <head> tags.

Script to disable right click on a web page

Here is the script

<script LANGUAGE="JavaScript1.1">
<!-- Begin
function right(e) {
if (navigator.appName == 'Netscape' &&
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' &&
(event.button == 2 || event.button == 3)) {
alert("YOUR MESSAGE HERE");
return false;
}
return true;
}

document.onmousedown=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=right;
// End -->

</script>