views:

211

answers:

4

How to show this type of reminder warning to user (mainly i need this for screen reader user), if user click on link which will open in new window?

Is my wording ok, please suggest if it can be better ? I want to show this message for any link of website or file like PDF, DOC etc. which is opening in new window?

Sometime user clicks mistakenly so i want to give another reminder.

I'm already using jquery so how to show like this warning box using jquery?

alt text

A: 

Add a click event to all a tags that have a target attribute that is _blank. The click event will display the confirmation dialog.

Finbarr
+1  A: 

In new window? I don’t know if I understood what you really want, but I believe the screenshot you captured is a notification triggered on unload event—if you use jQuery, check jQuery’s .unload().

Dominik
+1  A: 

use the onbeforeunload event on window. check http://stackoverflow.com/questions/821011/how-do-you-prevent-javascript-page-from-navigating-away

window.onbeforeunload = function() {
  return "Are you sure you want to navigate away?";
}
z33m
+1  A: 

If what you mean are links that have the target property set to *_blank*, you may do the following:

$("a[target='_blank']").click(
    function(){
        return confirm("Are you sure?");
    }
);
Satoru.Logic