I would open a link in a lightning component in another tab. Here is the code:

showAttachment : function(component, event, helper) {
    var idContentVersion = event.getSource().get("v.title");


    var action = component.get("c.viewContentDocument"); 

        idContentVersion: idContentVersion

    action.setCallback(this, function(response) {
        var status = response.getState();
        if (component.isValid() && status === "SUCCESS") {

            event.getSource().set("v.value", "one/one.app#/sObject/ContentDocument/"+response.getReturnValue());

            var urlEvent = $A.get("e.force:navigateToURL");
              "url": "one/one.app#/sObject/ContentDocument/" + response.getReturnValue(),
              "target": "_blank"
        else {
            console.log('Error: ' + status);                


I tried to add "target": "_blank" as event's parameters but it doesn't work. This method is called by clicking on a link: <ui:outputUrl aura:id="urlFile" label="" value="" target="_blank" click="{!c.showAttachment}"/>.

How can I resolve this problem?


As far as I understand, the navigation event will use the same window/tab if you give it a URL inside your salesforce instance. So, to get what you want, I think you could just use plain JS:

window.open("one/one.app#/sObject/ContentDocument/" + response.getReturnValue(), '_blank');

Sounds like you really do want a new window/tab, but in case you haven't seen it, there is an event you fire to preview Content in a lightbox kind of thing:



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.