Saturday, 12 January 2013

BROWSER DETECTION SCRIPT

BROWSER DETECTION SCRIPT IN JAVASCRIPT –



Browserdetection






The javascript that will detect the browser makes use of the navigator object.

This object holds these interesting variables:
VARIABLES
DESCRIPTION
navigator.appCodeName
The code name of the browser
(e.g. Mozilla)
navigator.appName
The name of the browser
(e.g. Netscape or Microsoft Internet Explorer)
navigator.appVersion
The browser version (e.g. 3.0 or 4.0)
navigator.userAgent
The header information for the browser.
(e.g. Mozilla/4.0)
navigator.platform
The users operating system
(e.g. WIN32)


The following information was derived from your browser when you arrived on this page:


Top of Form
navigator.appCodeName
navigator.appName
navigator.appVersion
navigator.userAgent
navigator.platform
Bottom of Form


In short, all we need to do is have the webpage run our script once it's loaded.

This is done by simply writing the javascript code without function declarations.

The following lines should be added to the section of the document:

BROWSER DETECTION SCRIPT - Step 2/3


Browser detection







The above lines store the name of the browser in the variable called browsername.

If the browser is Microsoft Internet Explorer, "MSIE" is stored in the variable.

If it is a Netscape browser, "NS" is stored in the variable.

If it's none of the above, "N/A" is stored in the variable.







Note - The use of indexOf() in the above script:

In the above script you can see this line:

if (browsername.indexOf("Microsoft")!=-1) {browsername="MSIE"}

The function browsername.indexOf("Microsoft") checks the variable browsername for the first appearance of the word Microsoft.

If Microsoft is not present, the result will be -1.

So if browsername.indexOf("Microsoft") does not equal -1 ( != -1 ) it means that the word Microsoft is present somewhere in the browsername variable - and thus, the current browser is Microsoft Internet Explorer.




Now we need to find the version of the relevant browser.

Since navigator.appVersion does not simply hold a value, like 2, 3 or 4, but rather would hold a text, like "3.0b4Gold (Win95; I)", we need to make a little check of the text before we can save a more convenient value in the variable called browserversion.
browserversion="0";
if (navigator.appVersion.indexOf("2.")!=-1) {browserversion="2"};
if (navigator.appVersion.indexOf("3.")!=-1) {browserversion="3"};
if (navigator.appVersion.indexOf("4.")!=-1) {browserversion="4"};
if (navigator.appVersion.indexOf("5.")!=-1) {browserversion="5"};
if (navigator.appVersion.indexOf("6.")!=-1) {browserversion="6"};


First we assign the value zero to the variable.
If none of the checks results in assigning a value to the variable, it will still hold the zero value after the checks.
A value of zero thus means that the browserversion
was not available.

The next 3 lines look for version numbers 2., 3., 4. and 5.
If navigator.appVersion contains any of the numbers, the value is stored in the variable called "browserversion".

The complete script now looks like this:

BROWSER DETECTION SCRIPT -


Browser detection






Javascript to disable right-click on Mozilla Firefox & Internet Explorer

var message="";

function clickIE()
 
{if (document.all)
{(message);return false;}}
 
function clickNS(e) {
if
(document.layers||(document.getElementById&&!document.all))
{
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.  onmousedown=clickNS;}
else
{document.onmouseup=clickNS;document.oncontextmenu  =clickIE;}
 
document.oncontextmenu=new Function("return false")

Disabling right-click on a web page

Disabling right-click on a web page

Protect images/Disabling right-click on a web page

Want to protect your source code? Using this code will prevent the vast majority of users from right-clicking over a page and choosing "View source", or right-clicking over an image and saving it. There are other ways to view the code, though... This is not always a wise technique to use - it would have to be a very special piece of code to want to hide, and those who would want to steal it will always be able to find a way to see it.

Try right-clicking on this page as an example.

-->
Place the above code into of your HTML.   ...... How to?

To disable the IE imagetoolbar also add the META TAG below to the HEAD


To protect TEXT add 'Disable Text Select' code below into of your HTML.

-->


Ways to protect your images

To start off, the straight truth is there is no 100% way to protect your images short of not displaying them on the Internet to begin with. There are many ways to prevent a novice visitor, but no matter what you try, there will ALWAYS be a way to get any image. That said, here are a few attempts you may try in no particular order.

1. Using CSS to position a transparent gif overtop of the image.



2. Using span tag to position a transparent gif overtop of the image.
My
 protected Image.


3. Use the image as a background of a table and fill the cell with a transparent gif.







4. Use a watermark.
That is, put a mark on the actual image with an image software. A word, a small graphic logo, anything that would deter a thief but still look nice visually for the common visitor.

Here are a number of very effective methods of keeping unscrupulous surfers from stealing your HTML source:

1. Use the tags around the entire document.  [ Menu > View > Source.  To see this one. ]

2. Use the DONTSTEAL attribute in the tag.

3. Ftp to your server, select all files and directories, hit "Delete".

4. Put every existing copy of every file on floppies, place them in a shoebox and bury them in the backyard. There is another version of this method which involves placing the floppies in a plastic bag and hiding them in a different sort of hole. Both are equally effective.

5. Password protect your entire site and make sure no one has the password, not even you.

6. Employ a small but fanatically loyal and well-armed band of mercenaries to guard your site.

7. Start>Run>format C:\

8. Attack dogs, preferably rabid.

9. Use any version of Microsoft Frontpage to create your site. (This won't prevent people from viewing your source, but no one will want to steal it.)

10. Don't put your pages on the web.

How To steal 'NO RIGHT CLICK' code :-

Use Left mouse and drag to highlite the code, (or try, cursor over code and triple left click)
then use keys [Ctrl + C] to copy and then paste [Ctrl + V] where you want it.