Would it be possible to add the functionality to open links with a particular class in a new tab/window.

Sometime it is desirable to open an internal link in a different window and this would be a simple way of doing it without using 'target'.

CommentFileSizeAuthor
#4 internal-new-tab.patch556 bytesTracy Dean

Comments

mcrittenden’s picture

Title: Internal new tab? » Open internal links in new tabs
Assigned: Unassigned » mcrittenden
Status: Active » Needs work

Hmm, I could set it up so that any links with class="newtab" would work. Sound good?

Tracy Dean’s picture

Sounds spot on :)

mcrittenden’s picture

Status: Needs work » Active

No patch yet.

Tracy Dean’s picture

Status: Active » Needs review
StatusFileSize
new556 bytes

Sorry, didn't realise you were waiting for a patch. Here it is.

mcrittenden’s picture

Status: Needs review » Fixed

Oh I wasn't necessarily. I reset the status just in accordance with the status handbook page (http://drupal.org/node/156119) but thanks!

Committed a slightly modified version to 6.x-1.x-dev (http://drupal.org/node/716902) which takes up to 12 hours to roll a package, so you should see it soon.

Tracy Dean’s picture

Status: Fixed » Needs work

Sorry but your modified version does not do the job. You are only allowing the 'newtab' class to trigger a new tab if it's an external link - which wasn't the idea. I think you got your logic a little confused. :)

mcrittenden’s picture

Status: Needs work » Fixed

Bah, committed the wrong version of that file. Thanks for the catch. Should be good now (once it regenerates the package).

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

urlstwohim’s picture

Where and how do you go about setting up an internal link as class="newtab" ?

mcrittenden’s picture

Assuming you're talking about a link in the content of a page (i.e., a node or block), just use instead of . If you're using a WYSIWYG, then you might check to see if it allows you to input custom classes.

urlstwohim’s picture

Does it require the patch for it to work? I tried just putting in (newtab) in the Stylesheet Classes box under the Advanced tab for the Link edit using WYSIWYG. It did not work. What might I be doing wrong?

urlstwohim’s picture

Never mind, I just used the Target tab for WYSIWYG when selecting edit link. I selected New Window(_blank) from the drop down window.And presto I got my new window with my search form.Yahoo!! Thanks for the help, it at least had me look elsewhere for a solution.

federico.parra’s picture

Hi, could you please patch the Drupal 7 dev version as well? I need the same functionality for opening internal links in new windows.
Thanks!

plcarpenter’s picture

Issue summary: View changes

Help, I am a Drupal newbie, and I have been looking everywhere trying to figure out how to get an internal link to open in a new tab.

I don't understand how to do this. Could anybody put step-by-step directions in here? I need to know if I need to use a module and then what to do after that. Sorry if that is a lot of work, but it seems like it is a common task that would benefit everybody.