On Sat, Jul 24, 2010 at 10:20 AM, Robert Cummings <robert@xxxxxxxxxxxxx>wrote: > On 10-07-24 04:19 AM, Adam Richardson wrote: > >> >> Code that resembled the below is how I used to open new windows before I >> started using jQuery Note, this completely avoids use of the target >> attribute. >> >> function wireNewWindows(){ >> if(document.getElementsByTagName){ >> var anchors = document.getElementsByTagName("a"); >> for(var i = 0; i< anchors.length; i++){ >> var node = anchors[i]; >> if(node.getAttribute('rel') == 'external' || >> node.getAttribute('rel') == 'nofollow'){ >> node.onclick = function(){ >> var url = this.href; >> window.open( >> url, >> >> 'newWin','width=700,height=500,Menubar=yes,Toolbar=no,Location=no' >> ); >> return false; >> } >> } >> } >> } >> } >> > > I try to avoid window.open() due to the proliferation of popup blocking. > > > Cheers, > Rob. > -- > E-Mail Disclaimer: Information contained in this message and any > attached documents is considered confidential and legally protected. > This message is intended solely for the addressee(s). Disclosure, > copying, and distribution are prohibited unless authorized. > Hi Rob, I agree, popup blockers are certainly a concern. However, most browsers appear to have a very focused definition of what constitutes a popup window. To my, albeit limited, knowledge, programmatically opening a new window in response to a user click is not blocked by the popup blockers provided by Mozilla, Safari, and IE 8 (although the default setting can be changed to block popups initiated by a user click, and this includes changing the behavior of the target attribute, too): tinyurl.com/2d3pq76 tinyurl.com/243fku8 tinyurl.com/38q2ua3 tinyurl.com/2co63x3 (key phrase on this page is "Google Chrome blocks popups from *automatically * appearing", emphasis added.) <http://support.mozilla.com/en-US/kb/pop-up+blocker#Is_the_pop_up_shown_after_a_mouse_click_or_a_key_press_>Popups that are sneaky (delayed response to click, mouse gesture, open immediately when you view the page, etc.) are much more likely to be blocked by various browsers, and the popup blocker tests I'm familiar with focus on these specific types of nefarious activity: tinyurl.com/gwsbu So, most of the time you can use window.open() to create a new window, stay true to the DTD you're using DOM scripting to manipulate, and avoid issues due to popup blockers. However, as is always the case, testing your particular implementation across the range of browsers representative of your intended audience is of paramount importance (i.e., don't blame me if you have issues because you didn't test your particular use cases ;) Adam -- Nephtali: PHP web framework that functions beautifully http://nephtaliproject.com