Open <anchor> with target="_blank"?
Asked Answered
U

1

1

I am using RazorPdf to generate a .pdf document from one of my controller actions. All works well, except that in my generated .pdf, I have an embedded anchor that opens yet another .pdf, that resides on the web site.

Currently, if the user clicks the anchor, the referenced .pdf opens in the same browser window. I don't want this behavior. I want anchor to open in a new browser tab (e.g. target="_blank"), but can't see any way to accomplish this. Here's my anchor in my view:

<!-- Note: target="_blank" does not work //-->
<anchor target="_blank" font="underline" name="top" reference="http://www.example.com/Downloads/Attachment.pdf">Click Here</anchor>
Uzial answered 11/6, 2013 at 19:3 Comment(0)
W
0

You could add some jquery function and call it on the click of the anchor tag

jquery function something like

$("#OpenAttachment").click(function (e) {

        var actionUrl = '/Downloads/Attachment.pdf';
        window.open(actionUrl, '', 'width=1000,height=800');
    });

This will open a new browser window. Hope this helps :)

Wardieu answered 9/7, 2013 at 11:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.