locked
CSSFriendly menu uses pop-up for target=_blank RRS feed

  • Question

  • User-985212943 posted

    I just discovered that if you use target = _blank for your menu item then the link will use javascript window.open, AKA a pop-up, which will most likely get blocked.  Why on earth is this being done? Is there an option to stick with the old target="_blank" instead?

    Friday, August 31, 2007 11:35 AM

All replies

  • User-534056067 posted

    The target attribute is not in the XHTML 1.1 spec from the W3. Since the adapter strive for the strictest compliance, the choce was made (by me) to avoid that attribute in favor of the solution using onclick and onkeypress that you observed. Are you certain that popup blockers are ready twarting this? I use this solution all the time and it seems to work wonderfully. Maybe I'm missing something. Do you have a recipe that I could follow to reproduce an actual problem?

    Saturday, September 1, 2007 3:39 AM
  • User-985212943 posted

    When I include target="_blank" in the MenuItem, the output includes  onclick="window.open(this.href,'_blank',")

    My client was complaining that some of her customers could not open the link.  I discovered that in IE7, if your Pop-Up Blocker settings were set to High (block all pop-ups) then this was treated as a pop-up and blocked.  I suspect that they had modified their filter settings to high.  When set to Med or Low, this is not a problem.

    This code:

    <Items>
        <asp:MenuItem NavigateUrl="http://www.all-waysrealestate.com/" Target="_blank" Text="Real Estate" />
    
    </Items>
    
    Produces this:
    
    <li class="AspNet-Menu-Leaf">
    	<a href="http://www.all-waysrealestate.com/" class="AspNet-Menu-Link" onclick="window.open(this.href, '_blank', ''); return false;" onkeypress="window.open(this.href, '_blank', ''); return false;">
    		Real Estate</a>
    </li>
    
    
     
    Wednesday, September 5, 2007 3:14 PM