It’s often necessary to make a script only accessible to the newer browsers (that can support the script without error) and keep older browsers from trying to work with it. This script, as an added plus, is very short. Just Cut & Paste this script even if you don’t plan to use it yet. It’ll come in handy some day!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | /******************************************************* * MYCPLUS Sample Code - https://www.mycplus.com * * * * This code is made available as a service to our * * visitors and is provided strictly for the * * purpose of illustration. * * * * Please direct all inquiries to saqib at mycplus.com * *******************************************************/ <!-- TWO STEPS TO INSTALL NEW BROWSERS ONLY: 1. Paste the coding into the HEAD of your HTML document 2. Add the last code into the BODY of your HTML document --> <!-- STEP ONE: Copy this code into the HEAD of your HTML document --> <html> <head><script LANGUAGE="JavaScript"> <!--Total Java Scripts 99 - Next Step Software--> <!-- Begin function onlyNewbrowsers() { browser = (((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 3 )) || ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 ))) if (browser) { alert('You are obviously using Netscape 3+ or MSIE 4+. Older browsers are not allowed to read this.....')} else {} } // End --> </script> <!-- STEP TWO: Put this code into the BODY of your HTML document --> <title>New Page 5</title> </head> <body> <form ACTION onSubmit="onlyNewbrowsers()"> <p><input type="submit" Value="New Browsers Only Script"> </p> </form> <!-- Script Size: 1.04 KB --> <p> </p> <!--This is not part of the script just the button to view source!--> <form> <p><input TYPE="button" NAME="view" VALUE="click me for the source of the page " OnClick="window.location="view-source:" +window.location.href"> </p> </form> <!--This is not part of the script just the button to view source!--> </body> </html> |