0

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 http://shup.com/Shup/308607/warning.gif

Jitendra Vyas
  • 148,487
  • 229
  • 573
  • 852

4 Answers4

2

use the onbeforeunload event on window. check How do you prevent a webpage from navigating away in JavaScript?

window.onbeforeunload = function() {
  return "Are you sure you want to navigate away?";
}
Community
  • 1
  • 1
z33m
  • 5,993
  • 1
  • 31
  • 42
2

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
  • 31,822
  • 31
  • 91
  • 141
1

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().

-1

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
  • 31,350
  • 13
  • 63
  • 94