SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    May 2008
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    focus on child window after navigating away from browser

    Hi,

    I have a form within a web application that allows users to delete records from a select list control. When the user clicks the delete button in the form, the application displays a jsp popup window. I have done everything i can think to do to lock the application down so that the user has to address the popup dialog before they can take any other action in the application.

    On clicking the delete button in the main window's form, the select list control is disabled. The jsp popup window declares an event in its body tag:

    onblur="self.focus()"

    Doing these two things has assured that, so long as the user doesn't navigate away from the browser, they will have to address the popup dialog by clicking a 'yes' or 'no' button, or they will have to dismiss it by clicking the 'X' close button at the upper right hand corner of the popup window.

    The problem is, when the user leaves the browser by selecting any other application, and then returns to the main window they are able to click on elements on the page at that point - doing so generates servlet errors in the application.

    I would like to either force the popup window to the foreground when the user returns to the web application. I want to avoid using javascript confirm() dialogs, as the application standard for this webapp is to use jsp popups.

    I have looked through a bunch of documentation on javascript events and DOM objects, and i cannot see a way i can do that.

    Does anyone have any ideas?

    Any help is greatly appreciated.

    Thanks,
    Jake

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,784
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The standards define focus and blur as being valid on <a> tags and form fields and nothing else. Some browsers support focus on windows as well and a few of those even support blur on windows but you can't rely on it because many browsers don't support it and are not required to because it is not somewhere that it is valid to use those events.

    If you want to control windows from javaScript then make them yourself within the current web page rather than opening real separate windows (which you can't guarantee anyway since your visitor can override those settings). See http://javascript.about.com/library/blmodald1.htm for an example.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Member
    Join Date
    May 2008
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the help. I'll play around with this


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •