Nice script in the form of alert messages Just add this code in <body> tag: <script> if (!confirm("Do you want to enter this site?")) window.location=history.go(-1) </script> you can change message like this <script> if (!confirm("Welcome to my UFC blog. There you can find latest UFC and Pride match clips, highlights,news ,fighters profiles,octagon girls and many more. Click OK to enter ")) window.location=history.go(-1) </script>
Do you happen to have the "Are you sure you want to leave this site?" message? Thanks for sharing this, I've been looking around for one
This is the javascript i use to make an alert when somone clicks a link or exit the page: <html> <head> <script> function goodbye() { alert('I see you are leaving the site\n\nPlease come back soon!'); } </script> </head> <body onunload ="javascript:goodbye();"> <a href="http://www.google.com/">Click here to show a goodbye alert</a> </body> </html> Clicking the link shows the message before you leave.
Here's another. This script disable right click <script language=JavaScript> 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") // --> </script>
In var message=""; , you can write your message , for example var message="No, No! This content is protected";
Ugh. I hate receiving those pop-up messages. Also, keep in mind that disabling right-click is horrible for people who like to open links in new windows and will in no way prevent the user from seeing your source code. Alienating your users is a good way to lose traffic.
So do I. That is why I use the NoScript extension for Firefox. If I want to leave a site, there is a reason for it and having me click on an alert box will guarantee that you will never see me again. As for the right click menu item to open in new window, I like my middle-button click which opens in a new tab. I think I have about worn out that button.
Agreed. Rarely do I not open a window in a tab anymore, but many IE users still use the old right-click, open in new window routine and few know about the shift-key shortcut.
@steelfrog - disabling the right-click was used to deter nosy competitors from doing certain functions when they were visiting your site. It was only a nuisance then, and people were pretty savvy and got around it anyway. Now it is basically a useless script with the tools we have available today. As for the new window thing in IE, doesn't the middle-button work there too? Of course, you are probably right about most people not even knowing about that either.
Disable picture copy. <script language="JavaScript1.2"> var clickmessage="insert you text" function disableclick(e) { if (document.all) { if (event.button==2||event.button==3) { if (event.srcElement.tagName=="IMG"){ alert(clickmessage); return false; } } } else if (document.layers) { if (e.which == 3) { alert(clickmessage); return false; } } else if (document.getElementById){ if (e.which==3&&e.target.tagName=="IMG"){ alert(clickmessage) return false } } } function associateimages(){ for(i=0;i<document.images.length;i++) document.images.onmousedown=disableclick; } if (document.all) document.onmousedown=disableclick else if (document.getElementById) document.onmouseup=disableclick else if (document.layers) associateimages() </script>
Who uses right-click open in new window. In Firefox I just click the scroll button and open the link in a new tab
hmmmm I use both open in new window and new tab, for all browsers And the js alert box is so 90s, I will never return after the initial visit to a site with this script
yeah thats true about how you might not want to return after you see that box, but I believe that if used properly it can be a good thing, but if you just use it as a welcome message or a "are you sure you wanna leave message" it can be very bad for returning visitors. So it all depends on how you use it.