Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Internal vs External Links
Is there any way to get internal forum links to always open in the same window, yet have all external links open in a new window, by default?
I guess there must be a better way to do it than using 'base', '_top' and '_blank' html definitions...
I guess there must be a better way to do it than using 'base', '_top' and '_blank' html definitions...
0
This discussion has been closed.
Comments
1. Saying "fuck it" and using the target attribute anyway
2. Opening a new window with javascript (a little buggy)
3. Letting users choose whether they want to open a link in a new window or not through the standard browser mechanism.
Is there any firefox addon which lets you chose to open a link in the current tab (even if its targeted blank)?
i learned after the first time i had to educate a user on firefox that tabbed-browsing is *absolutely* a power-user mechanism. it blows people's minds.
and i agree... letting the user decide is always best, i was just curious if there was a "proper" way to do it, if it had to be done.
I quite agree with this article. The average user doesn't always realised a new windows had been opened and he is quite frustated when he can't use the back button.
That is an issue as well with some redirect fonctions and some use of ajax...
Let people open links in a new windows or a new tab by themself is the best thing to do...
But when I have to create this kind of link I do like that:
myjs.js:
function winOpen(URL, windowName, width, height, resizable, location, menubar, scrollbars, status, toolbar){ var windowFeatures; windowFeatures = ''; if (width != '' && width != null){ windowFeatures = windowFeatures+'width='+width+','; } if (height != '' && height != null){ windowFeatures = windowFeatures+'height='+height+','; } if (resizable){ windowFeatures = windowFeatures+'resizable,'; } if (location){ windowFeatures = windowFeatures+'location,'; } if (menubar){ windowFeatures = windowFeatures+'menubar,'; } if (scrollbars){ windowFeatures = windowFeatures+'scrollbars,'; } if (status){ windowFeatures = windowFeatures+'status,'; } if (toolbar){ windowFeatures = windowFeatures+'toolbar,'; } popupWindow = window.open(URL, windowName, windowFeatures); popupWindow.focus() } function ext(){ winOpen('', 'ext', 552, 400, true, true, true, true, true, true) }
mypage.htm:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> ... <script language="javascript" src="myjs.js" type="text/javascript"></script> ... </head> <body> ... <a href="http://lussumo.com/" onclick="ext()" target="ext">Lussumo.com</a> ...
That is still intrusive but that works for users with js disable and that the page will be be open in a little windows for other users.