window.open, won't


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 8 of 8

Thread: window.open, won't

  1. #1
    Join Date
    Mar 2008
    Location
    Sunny Sacramento, CA
    Posts
    1

    Question window.open, won't

    I am having a problem showing a new window with javascript. When a user clicks a linkbutton on my page, it should show BalanceReport.aspx with the accompanying parameters, instead it does nothing. It always works on my system (naturally), it always works on another users' system, and it never works on yet another users' system. In the Page_Load event I do some database stored procedure calls and fill a stringbuilder with HTML that is sent to the page in an asp:Literal control. That seems to work. Javascript is enabled on our browsers (IE6 xpSp2). There are no popup blockers on the suspect system, and other window.opens work. I am unsure where to look next.

    This link works:
    const string cOnClientClickTemplate = "javascript:window.open('ClaimPopup.aspx?CompPK={0}&ProviderName={1}&FundType={2}',";
    const string cPopupDialogArgs = "'newWindow','width=500,height=450');return false;";
    NewDiscClaim.OnClientClick = String.Format(cOnClientClickTemplate, ViewState["CompPK"].ToString(), ViewState["ProviderName"].ToString(), "disc") + cPopupDialogArgs;

    This link does not work:
    const string cOnClientClickReportTemplate = "javascript:window.open('BalanceReport.aspx?CompPK={0}',";
    const string cReportDialogArgs = "'newWindow','width=800,height=800,resizable=yes, menubar=yes,toolbar=yes');return false;";
    lbtnReport.OnClientClick = String.Format(cOnClientClickReportTemplate, ViewState["CompPK"].ToString()) + cReportDialogArgs;

    Any ideas? Thanks.

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Welcome to DevX
    Quote Originally Posted by goodideadave
    I am having a problem showing a new window with javascript. When a user clicks a linkbutton on my page, it should show BalanceReport.aspx with the accompanying parameters, instead it does nothing. It always works on my system (naturally), it always works on another users' system, and it never works on yet another users' system.
    Then it probably isn't your code. You need to check out the system the person is using where it doesn't work and figure out what is different on theirs from yours. There is no set in stone resolution for these kinds of issues. It is trial and error at its finest.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    First FYI : "javascript:blabla()" is not standard .. call the function directly :
    OnEvent="blabla()" ...

    second the general known issue is pop-up blocker ... IE6-SP2 has an embed pop-up blocker , Yahoo toolbar block pages without any prompt just a sound that may be not clear or turned off (the sound) ... and similar in many plugins that install them selfs without just the user know about them [like yahoo and msn toolbar if you don't choose custom install they come installed, in firefox the same for google toolbar]

    so what I have first is to check the system yourself and see what happens, then the common mehod to prevent the blcking is to put the "window.open()" function just directly after a USER-CLICK event , the first executed statement .. in that case pop-blocker should never block it ...

    hope this can help.
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  4. #4
    Join Date
    Feb 2008
    Posts
    21
    My suggestion is to use a hyperlink instead of link button. If u want to open the contents in a new window, u can use target="_blank" attribute, and u can give the url to which the path u want in the navigateurl attribute.

  5. #5
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    He doesn't need to change his code.

    He needs to figure out why it doesn't work on this one PC.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  6. #6
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819

    Arrow

    Quote Originally Posted by Hack
    He doesn't need to change his code.
    Why not .. maybe some times we need to change some code to be portable for all systems ... and machines types. [or generally we put handlers ..]
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  7. #7
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    My experience has been that when code runs just fine on all but one or two PCs, 99.99% of the time it is because of an issue with the PC, not the code.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  8. #8
    Join Date
    Jan 2008
    Location
    http://www.GlobalGuideLine.com
    Posts
    12

    Post

    Hi. below code will help you a little bit but the details with examples are available on the link at the bottom of this reply.

    Code:
    <html>
    <head>
    <script language="javascript">
    function enterNewLocation(){
      var loc=prompt("You are going to this location now:\n"+
        window.location,"http://www.google.com");
      window.location=loc;
    }
    </script>
    </head>
    <body>
    <center>
    <input type="button" 
      onclick="enterNewLocation()" value="Show current URL">
    </center>
    </body>
    </html>

    Examples of JavaScript Location and Widows Object:
    http://www.globalguideline.com/JavaS...cation_Objects
    Online Web Tutorials http://www.GlobalGuideLine.com

Similar Threads

  1. Session issue on window.open
    By Alex in forum ASP.NET
    Replies: 1
    Last Post: 08-25-2002, 10:56 PM
  2. window.open in ASP.Net
    By Greg Rothlander in forum ASP.NET
    Replies: 2
    Last Post: 11-24-2001, 04:46 PM
  3. Replies: 2
    Last Post: 07-26-2001, 06:06 PM
  4. Replies: 1
    Last Post: 07-17-2001, 08:53 PM
  5. Window.open problem
    By gia in forum Web
    Replies: 0
    Last Post: 06-05-2001, 03:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center