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.

Open Links in new Windows???

uziuzi
edited January 2008 in Vanilla 1.0 Help
How to make the links be opened in the new window? CSS???
«1

Comments

  • I *know* we've had this exact discussion here.
  • which links?
  • http://lussumo.com/community/discussion/2105/
  • Bergamot, are we in the twilight zone?
  • uziuzi
    edited June 2006
    yeah ok, guys.... but ctrl-click is not the solution....

    how to make this javascript thing in vanilla?


    I think this option should be "user editable" in vanilla settings to let the admin decide how to make it on his forum ;)
  • edited June 2006
    /me points to the discussion linked to.
    It contains two possible Javascript solutions. here and here.

    If you want it user editable, an extension would be the way to go! :D
  • It is probably the way, but I am not able even to write a couple of code... so, waiting for anyone making it, is the only solution for me :(
  • which links do you want to be opened in a new windows?

    If it is the links in the comments, the Extended Text Formatter already do that I think.
    function AutoLink($String) { $String = str_replace(array(""","&"),array('"','&'),$String); $String = preg_replace( "/ (?<!<a href=\") (?<!\")(?<!\">) ((https?|ftp):\/\/) ([\@a-z0-9\x21\x23-\x27\x2a-\x2e\x3a\x3b\/;\x3f-\x7a\x7e\x3d]+) /msxi", "<a href=\"$0\" target=\"_blank\" rel=\"nofollow\">$0</a>", $String); return $String; }
  • I have Extended Text Formatter 1.0 activated, but it replaces only the web-adresses through a link... it doesn't open it in a new window. I use also the bbcode and bbcode-buttons extenions, is there a possibility to make it there?
  • blizeHblizeH ✭✭
    You do realise how bad an idea this is, right?
  • why bad?
  • blizeHblizeH ✭✭
    Ahh, ignore me, I was fresh out of reading Jakob Nielson's twenty page rant on why opening links in new windows is /very/ bad! ;-)
  • aha! I know the problem ;))))))))))))))))))))))))
  • edited July 2006
    I made an extension for this, since people on my forum were begging for popup windows.

    > Window Links
  • lamentlament
    edited July 2006
    i prefer to have control over how I open my links (middle mouse click opens a link in a new tab in Firefox, thank you), and hate when sites/forums force a link to open in a new window.
  • thing is i set on firefox for all thngs that should open new window to be forced into new tab
  • Wow, thanks Immersion - I didn't know you could do that! That's going to save me a lot of frustration in future.

    By the way, that extension lets users choose whether or not they want links to open in a window.
  • Our Vanilla installation is based in an iframe (I know, I know), and we have to have user posted links open in a new window. How can we do this and where do we apply the code? The new window extension does not work for us whatsoever for some reason.
  • edited July 2006
    Are these links to other sites, or links to other parts of your own site? The extension only opens external links in a new window. If you want it to open all user posted links in new windows, this might work:

    Open functions.js and look for the following line:
    if (fileLink.href.match(/^(http|https)/) && (fileLink.href.indexOf(location.hostname) == -1)) {

    and replace it with this:
    if (fileLink.href.match(/^(http|https)/)) {

    Hope that helps!
  • Ink, thank you! The extension works without the fix. I guess he forgot to check "Open external links in a new window" in the user Forum Preferences

    I have one question, is there any way to enable it by default instead of having the users individually enabling it?
This discussion has been closed.