For external links, the overlay is adding a "_new" target attribute. The effect of this in Firefox for the first link for example is that there is one single new tab opened which is focused when you click the link. After that though, if the page has other such links, clicking those will replace the content of the previously opened tab *and* will not give focus to that tab. When you build a page output, you could use target="_blank" to always get to open a new tab and always get focus to that, but overlay-parent.js will override any such attempt. It should not.

Files: 
CommentFileSizeAuthor
#21 overlay_target-771036-d7-21.patch750 bytesAlbert Volkman
PASSED: [[SimpleTest]]: [MySQL] 38,069 pass(es).
[ View ]
#17 overlay_target-771036-17.patch770 bytesolofjohansson
PASSED: [[SimpleTest]]: [MySQL] 34,219 pass(es).
[ View ]
#14 overlay_target-771036-14.patch750 bytesolofjohansson
PASSED: [[SimpleTest]]: [MySQL] 37,811 pass(es).
[ View ]
#11 overlay_target-771036-11.patch770 bytesolofjohansson
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch overlay_target-771036-11.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#9 overlay_target-771036-9.patch686 bytesolofjohansson
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch overlay_target-771036-9.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
overlay-target.patch910 bytesGábor Hojtsy
PASSED: [[SimpleTest]]: [MySQL] 19,166 pass(es).
[ View ]

Comments

Status:Needs review» Reviewed & tested by the community

I agree.

Status:Reviewed & tested by the community» Fixed

Committed to CVS HEAD. Thanks.

Status:Fixed» Closed (fixed)

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

I have the same 'issue', but different situation, with internal links. With external links, there are checks to not overwrite the target if one exists. However, with internal links, the target attribute is always set to "_parent". I can see the desire to keep with the idea that if the link stays on the site, then open it in the same window. At the same time, if I want to open a link in a new window with target="_blank" why should overlay trump my wishes of how to handle the link.

Status:Closed (fixed)» Needs review

Forgot to change status before

I also want to use target="_blank" for a link when user is editing content. I don't want to use the same tab/window because they will lose their changes!

I got the same need for using target="_blank" link in the overlay.

In my case i want to create the following link in the help text of a field:
<a href="/node/add" target="_blank">Create new node</a> because I don't want the user to lose the current node edit form while creating another node. (often used when trying to reference a node that does not yet exist)

I have the same need as Yuri. I want to add a button with Form API to a node edit form, wrapping the button with the prefix and suffix attributes with a tag with target="_blank", to open a node addition form in a new window / tab.

StatusFileSize
new686 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch overlay_target-771036-9.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

I've also experienced this issue.

If the link is external, the target won't be overridden if it already has been set. I can't see why this couldn't be implemented for internal links as well.

Status:Needs review» Needs work

The last submitted patch, overlay_target-771036-9.patch, failed testing.

StatusFileSize
new770 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch overlay_target-771036-11.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Status:Needs work» Needs review

Status:Needs review» Needs work

The last submitted patch, overlay_target-771036-11.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new750 bytes
PASSED: [[SimpleTest]]: [MySQL] 37,811 pass(es).
[ View ]

Ok, seriously, my apologies.

Third time's the charm!

Version:7.x-dev» 8.x-dev
Status:Needs review» Needs work

I didn't test it, but the patch looks good and makes sense. Just needs a quick reroll for Drupal 8...

I've done some limited testing on it and it works :-)

StatusFileSize
new770 bytes
PASSED: [[SimpleTest]]: [MySQL] 34,219 pass(es).
[ View ]

And here's the same patch for Drupal 8.

Status:Needs work» Reviewed & tested by the community

This looks ready to go, for both Drupal 8 and Drupal 7.

A quick way to test it is to use the Field UI to add some help text to the body field on the node form (and have the text be something like <a href="/node" target="_blank">Home</a>)... I tried that and confirmed that before the patch this link won't open in a new window, but with the patch it will.

D'oh, just realized that the test scenario I came up with is almost the exact same thing Yuri said in #7... Well, it definitely works :)

Version:8.x-dev» 7.x-dev
Status:Reviewed & tested by the community» Patch (to be ported)

Thanks! Committed/pushed to 8.x. Moving to 7.x for backport.

Status:Patch (to be ported)» Needs review
StatusFileSize
new750 bytes
PASSED: [[SimpleTest]]: [MySQL] 38,069 pass(es).
[ View ]

D7 backport.

Issue tags:+needs backport to D7

Fixing tag.

What needs happen to get this patch committed to core??

You can help by doing a patch review!

http://drupal.org/patch/review

While testing this check if the overlay stays open after clearing the cache....

#21 works for me, look forward to see this patch committed to 7.x

Hi. Patch in #21 does NOT work for me.

I am trying to add a link through Views actually, writing this code in the Header part of the view:

<?php
if (user_access('create page content'))
  print
'<strong><a target="_blank" href="node/add/page">Create new item</a></strong>&nbsp;&nbsp;';
?>

Overlay open in the same direction.

BTW, is was better if I could add destination parameter while opening in the SAME tab, but I couldn't find any documentation of how to do in a simple PHP snippet inside a view. The naive code might be something like this:

<?php
if (user_access('create page content'))
  print
'<strong><a href="node/add/page&destination=' . current_path() . '">Create new item</a></strong>&nbsp;&nbsp;';
?>

Any help - either for making it open in a new tab or to redirect back to the original URL - will be appreciated!

Thanks.

Status:Needs review» Reviewed & tested by the community

I've tested the patch in #21 with an internal link with target="_blank" in a field's help text, as described in #18 (which happens to be exactly my use case).

With the patch applied the link does open in a new window. Codewise the patch is the same as what was committed for D8, so I think this is reviewed and tested.

Re #27: I think you need to write the link like this:

<?php
print l('Link text', 'node/add/page', array(
 
'attributes' => array(
   
'title' => "Title text."),
  
'query' => array(
    
'destination' => current_path())));
?>

api.drupal.org/api/drupal/includes!common.inc/function/l/7

+1 For this !

Why has it not been committed yet ? The backport patch is almost a year old :-).

Status:Reviewed & tested by the community» Fixed

Status:Fixed» Closed (fixed)
Issue tags:-needs backport to D7

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

It seems that the patch only works for non-admin links, due to this condition:

if (this.isAdminLink(href))

My requirement is that the user is adding a node, and in the description of one of the fields I want to let them add another type of node, but I don't want them to lose their progress in the current form. Therefore I give it a target of _blank, but because it's an admin link, the target is ignored and it gets opened in the overlay.

I don't know if anything has changed since the patch in 7.22, because it seems to me that #7 and #18 are exactly the same requirement I have and the patch that was committed (#21) does NOT resolve it.

I managed to solve this by adding the overlay-exclude class:

<a class="overlay-exclude" target="_blank" href="node/add/thing">Add a thing</a>

This means all of the overlay-related code is skipped, and the link will simply be opened as normal, using whatever target you give it. Using the overlay-exclude class actually obviates the need for the fix in patch #21.