Solved

Javascript Popup Opens in Background in .NET Application

Posted on 2013-11-06
4
283 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

734 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