Popups, javascript, IE, tabs & co.

Last post 11-02-2007 5:14 AM by brinsky. 4 replies.

Sort Posts:

  • Popups, javascript, IE, tabs & co.

    10-25-2007, 4:44 AM
    • Loading...
    • brinsky
    • Joined on 10-25-2007, 3:39 AM
    • Slovenia
    • Posts 38

    Hi all!

     

    I've built this customer support web site. Because the service is not self-explanatory, I decided to do a help page.

    For site navigation I use a webcontrols.menu component with four menu items. First three have navigateUrl property specified, and the last one should pop up a window with help.

    The reason i chose popup is because it looks very smooth if your application window is resized to 2/3 of width to the left side and help window pops up on the last 1/3 to the right.

    Because the menu/menuitem components have no Attributes property, it's kind of hard registering javascript to the onClick event. What I've tried to do is I have changed body tag runat event to "server" and whenever a user clicks on the help menuitem javascript with popup is registered to body onload event - which works fine on localhost. There's a catch to the published version though. Although the script is registered the popup gets supressed. Tried to mess with the javascript a bit, no solutions found.

    So this is my first question - how to tell asp.net it should tell the browser that the window.open method is something we want to be executed?

     

    Moving along.. I tried a different approach. I tried to simplify the whole mess and just went for the navigateUrl property and changed target to "_blank". Here's another catch, the tabs namely. If a user's browser is set to use tabs rather than new windows, the help pops up as a tab and the whole idea of having paralel windows goes down the drain.

    That would be my second question - is there a way of forcing a browser to open a site in a new window rather than instantiating a new tag?



    Do you guys have any other approach up the sleeves? All i want is that on a menuitem click a new window is opened, some js should be executed to modify the width and position of both windows.

    Help much appreciated! 

     

     

    These days I'm nostalgically remembering classic ASP times. <-sniff->

    Filed under: , , , , , ,
  • Re: Popups, javascript, IE, tabs & co.

    10-25-2007, 7:05 AM
    Answer
    • Loading...
    • ca8msm
    • Joined on 11-29-2005, 10:57 AM
    • http://aspnetlibrary.com
    • Posts 2,145

    You can use the window.open method and register your javascript from the server by using the ClientScript.RegisterStartUpScript method. 

    Mark,
    Join me at the new IT Community of the 21st Century: http://lessthandot.com

    Please remember to click "Mark as Answer" on this post if it helped you
  • Re: Popups, javascript, IE, tabs & co.

    10-25-2007, 7:14 AM
    • Loading...
    • A1ien51
    • Joined on 05-06-2005, 6:46 PM
    • MD USA
    • Posts 2,915

    It s caled a pop up blocker is blocking it. Pop Ups are a bad idea for navigation.

    If you do not want them to be blocked, you would have to add the site to the whitelist.

     
    Eric 

  • Re: Popups, javascript, IE, tabs & co.

    10-25-2007, 7:15 AM
    • Loading...
    • A1ien51
    • Joined on 05-06-2005, 6:46 PM
    • MD USA
    • Posts 2,915
    Got to love double submissions....removing this one..
  • Re: Popups, javascript, IE, tabs & co.

    11-02-2007, 5:14 AM
    • Loading...
    • brinsky
    • Joined on 10-25-2007, 3:39 AM
    • Slovenia
    • Posts 38

     I did register the script using ClientScript.RegisterStartUpScript method. The problem was i couldn't add the 'onclick' attribute to the menuitem, that's why I did some workarounds also using the same register method with no success. Anyway, at the end I did nail it. Sadly I had to substitute the menuitem with a button, nevertheless it's working now.

    Just in case anyone has a similar problem, there's no solution for the problem if you use framesets. Rather redirect the client to the actual page. I'm guessing IE acts this way because of 'fishing' prevention.

    And yes, popups work if you register the script the right way. 

     

    Thanks for your replies,  

Page 1 of 1 (5 items)
Microsoft Communities
Page view counter