function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Purushottama SahuPurushottama Sahu 

How to redirect to parent window(VF Page) from lightning component

I have scenario like calling a lightning component from VF page. Once value updated in lightning component the value should be update in VF page.
I have used 'window.opener.location.href' in lightning client side controller to redirect to VF page from lightning component. But this event is blocked in lightning.
I have tried another approach in lightning component like:
<a href="!javascript:top.window.opener.closeCampaignLookup('{!a.id}','','','')">{!acc.Name}</a>
But could not save lightning component, since getting error like "Cannot mix expression and literal string in attribute value, try rewriting like {!'foo' + v.bar}: " Please help me on this.
Sunil MadanaSunil Madana
In this above stated problem you cannot use expression inside a javascript function, instead i would pass the {!a.id} on click to a javascript function and then open it in a new window like below:
<a href="#" title="{!a.id}" onclick="javascript:closeCampaignLookup(this);">{!acc.Name}</a>

function closeCampaignLookup(element) {
    var element_title =element.title;
    top.window.opener.location = your_redirect_URL?id=element_title;
}
Hope it helps and mark answer correct so that it helps others.
Purushottama SahuPurushottama Sahu
Hi Sunil, 
Thanks for responding, i have already tried to write the same logic in Java script but its not working because top and opener functions are blacklisted in lightning. Can you suggest any other way to achive this functionlaity.