When displaying a file field the tooltip states "Open file in new window" but the link open in the same window.

It seems the target attribute for the link is not set. Attached is a patch that adds the target.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Denis Danielyan created an issue. See original summary.

Akshay kashyap’s picture

Status: Needs review » Needs work
FileSize
181.11 KB
121.38 KB

I have review the patch, apply successfully and working fine. I have attached after and before images.
But in the FileLink.php file found some indentation issue.

develdru’s picture

Assigned: Unassigned » develdru
Status: Needs work » Needs review
FileSize
609 bytes

Hi, I have created a patch file, please review.

thanks

develdru’s picture

Assigned: develdru » Unassigned

markhalliwell’s picture

Status: Needs review » Fixed
Issue tags: -file link target

Status: Fixed » Closed (fixed)

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

vidhatanand’s picture

Is this committed to 3.x branch?

madmen’s picture

?

Anonymous’s picture

window.open('http://example.com/', '_blank');.I am using this JQuery code to open a link in new tab , for that i had to reverse this patch first , as it led to ambiguity. It shouldn't be made fixed here , sometimes it is not required to open external link in new tab , help tooltip text should have been changed.

markhalliwell’s picture

It shouldn't be made fixed here

  1. window.open is just plain old JavaScript, not jQuery.
  2. You can prevent default behaviors for any element in JavaScript (including links from opening new tabs/windows). In fact, I actually just created a rudimentary example (without jQuery) for you: http://jsbin.com/zaturel/edit?html,js,console,output
  3. Generally speaking, clicking these file links (which are usually on edit pages of entities) shouldn't navigate you away from that page. Thus,
    that is why they open in a new window (for UI/UX purposes). If, for whatever reason, you don't like this default behavior... you are certainly entitled to create a sub-theme and remove this attribute from each item's attribute array.