Results 1 to 4 of 4

Thread: window.focus()

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049

    Question window.focus()

    When I call this function the window appears as desired but the window is not focused. Isn't that possible? Still the mother window is focused.

    Code:
    Sub JavaScriptAlertRedirect()
            Dim strScript As String = ""
    
            strScript = "<script>"
            strScript = strScript & "var winName = 'w';"
            strScript = strScript & "var winFeatures = 'width=520,height=640,top=0,left=0,status';"
            strScript = strScript & "var winURL = 'http://localhost/Prisberegning2004/udskrift.aspx';"
            strScript = strScript & "var w;"
            strScript = strScript & "w = window.open(winURL,winName,winFeatures);"
            strScript = strScript & "w.focus();"
            strScript = strScript & "</script>"
    
            'Allows the alert box to be shown without wiping the controls off the page.
            Page.RegisterStartupScript("ClientScript", strScript)
        End Sub

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276
    That works for me. What browser are you using?

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049
    It's Win200 Pro with IE 6.0.2800.1106CO and the window from which I redirect remains active and the new window is placed in the background

  4. #4
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276
    When are you calling JavaScriptAlertRedirect() ?

    The main page may be doing more processing and somehow keep focus.

    I just did a test of your function on a button click and it works fine. I have the exact same OS and IE version.

    You may try setting status=no in the winFeatures var

Posting Permissions

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



Click Here to Expand Forum to Full Width