+ Start a Discussion
Rakesh ChattyRakesh Chatty 

How to open page in new tab and with formated/Custom URL on click of Quick Action Button

Hi All, 

I Have Qucik Action Button Which calls Lc Componennt and LC component will navigate to LWC.

for now on click of Quick Action it is showing in same page.

i want to open in new page with custom URL.

can someone suggest me. 
here my code 

LC : Component
 

aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction,lightning:isUrlAddressable" >
    <lightning:navigation aura:id="navService"/>
    <aura:attribute name="pageReference" type="Object"/>
    <aura:handler name="init" action="{!c.navigateToLC}" value="{!this}" />
</aura:component>
 
 navigateToLC : function(component, event, helper) {
        var pageReference = {
            type: 'standard__component',
            attributes: {
                componentName: 'c__searchcomponent1_LWC'
            },
            state: {
                c__refRecordId: component.get("v.recordId")
            }
        };
        component.set("v.pageReference", pageReference);
        const navService = component.find('navService');
        const pageRef = component.get('v.pageReference');
        const handleUrl = (url) => {
            window.open(url);
            console.log(component.get("v.recordId"))
        };
        const handleError = (error) => {
            console.log(error);
        };
        navService.generateUrl(pageRef).then(handleUrl, handleError);
    }

Thanks in Advance.
Suraj Tripathi 47Suraj Tripathi 47
Hi,

Use window.open(url, "_blank");
To open a link in new URL.

Please mark it as Best Answer if it helps you.

Thanks & Regards
Suraj Tripathi

 
Guduli Das MohapatraGuduli Das Mohapatra
Hi window.open(url, "_blank"); is not working in IOS app .Is there any work arround for this .