Help - Search - Members - Calendar
Full Version: Make Web Links Open in a New Window?
Movable Type Community Forum > Additional Resources > Tips and Tricks
jpfrantz
I know how to do this using staight HTML, but how do I get MT to add the 'target=_blank' attribute from the Edit window when I choose the URL button?

Is the code for those buttons accessible somewhere so I can edit them?

Thanks,
JP
kadyellebee
Check out this thread smile.gif

Kristine
sudama
Remember, coding links to open new windows is considered harmful. wink.gif
gvtexas
QUOTE (sudama @ Jul 15 2003, 03:41 PM)
Remember, coding links to open new windows is considered harmful.

That is a debatable point...Mark's main focus on why not to seems to be based on accessibility issues for users needing extra help...there is also the argument that you want users to leave your site via a new window so that your site remains in the parent window when they're through with the new one...not saying either way is wrong (or right!), but am saying (IMHO) that opening to a new window is not considered bad by everyone.
sad.gif smile.gif
gvtexas
QUOTE (jpfrantz @ Jul 15 2003, 10:52 AM)
I know how to do this using staight HTML, but how do I get MT to add the 'target=_blank' attribute from the Edit window when I choose the URL button?

I found the easiest (and quickest) way is to edit the edit_entry.tmpl located in your /tmpl/cms folder:

CODE
Change the last line of this section, about line 123:

function insertLink () {
   if (!document.selection) return;
   var str = document.selection.createRange().text;
   if (!str) return;
   var my_link = prompt('<MT_TRANS phrase="Enter URL:">', 'http://');
   if (my_link != null)
       document.selection.createRange().text = '<a href="' + my_link + '">' + str + '</a>';
}

to
       document.selection.createRange().text = '<a href="' + my_link + '" target="_blank" >' + str + '</a>';
}


Basicially you're just adding target="blank" between the last double quote and the right end bracket for the a href string.

Cheers,
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.