Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Javascript Popup Opens in Background in .NET Application

Posted on 2013-11-06
4
Medium Priority
?
290 Views
Last Modified: 2013-12-08
Hi!

For several years our .NET application has opened a popup in the foreground every time. I use:

Page.ClientScript.RegisterStartupScript(GetType(String), "Popup", "window.open('STUDLogList.aspx','pop','width=900,height=450,top=312,left=190,scrollbars=1');", True)

Lately the popup has started to open in the background without any change in code. Do you have any suggestions to help this?

Searching Google I can see at lot of people have exactly the same problem and a lot of suggestions to help it but I cannot make it work.
0
Comment
Question by:Kim Neesgaard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 3

Expert Comment

by:mikeyd234
ID: 39627228
Is this behavior occurring on a specific browser or on all?
0
 

Author Comment

by:Kim Neesgaard
ID: 39627330
My company uses Internet Explorer but I have downloaded Chrome and here it doesn't work at all - no popup is shown.
0
 

Accepted Solution

by:
Kim Neesgaard earned 0 total points
ID: 39694860
I have found a solution!

Insert a Javascript function like this:

<script type="text/javascript" language="javascript">
    function PopupOpen()
{
    window.open('YourFile.aspx', '_blank', 'width=900,height=450,top=312,left=190,scrollbars=1')
}
</script>

and call the popup like this:

Dim csname1 As [String] = "PopupScript"
            Dim cstype As Type = Me.[GetType]()

            ' Get a ClientScriptManager reference from the Page class.  
            Dim cs As ClientScriptManager = Page.ClientScript

            ' Check to see if the startup script is already registered.  
            If Not cs.IsStartupScriptRegistered(cstype, csname1) Then
                Dim cstext1 As New StringBuilder()
                cstext1.Append("<script type=text/javascript> ")
                cstext1.Append("window.attachEvent('onload',PopupOpen) </script>")
                cs.RegisterStartupScript(cstype, csname1, cstext1.ToString())
            End If

This ensures that the popup code is the LAST to run. I have checked the solution and it works perfect for me.
0
 

Author Closing Comment

by:Kim Neesgaard
ID: 39704120
This solution simply works!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question