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
jayanth reddyjayanth reddy 

window.parent.location replacement to lightning

This is the script i am having in classic version 
I want to do it in lightning 
I tried, but it is redirecting to classic version
Can anyone suggest me with solution.
 
<script>
 function AttachDocuments(oId)
        {
            //alert('test');
             var url="/apex/abcd?conId=" + oId ;       
                       
            window.parent.location = url;
            
            return false;
           
        }     
function refreshParent(dId)
        {
            window.parent.location ='https://my.salesforce.com/setup/own/deleteredirect.jsp?retURL=%2F00P%2Fo&delID=00P0v000000FYuXEAW&_CONFIRMATIONTOKEN=VmpFPSxNakF4Tnkwd055MHhOVlF3TWpvME1qb3pPUzQwTVRSYSxaWVhvTllJNlZ0TU1LdzkweTZpWU1FLE5';
            var url="/" + dId ;       
                       
            window.parent.location = url;
            
            return false;
        }
        <!-- Delete attachement -->
        function checkDelete(contactId){
          alert('Are you sure want delete');
             var url="/" + contactId;       
                       
            window.parent.location = url;
            
            return false;
        
        }
    </script>
Deepali KulshresthaDeepali Kulshrestha
Hi Jayanth,

In Lightning force:navigateToURL  opens a new tab for external URLs if you want to open in new tab you can use navigateToURL

    var eUrl= $A.get("e.force:navigateToURL");
    eUrl.setParams({
      "url": 'https://www.youraddress.com/' 
    });
    eUrl.fire();
    
    In case you want to open in the same tab you need to use standard javascript as 
    window.open('www.youraddress.com','_top')
    
For more detail refer to these links:
https://developer.salesforce.com/forums/?id=9060G0000005UlIQAU
https://salesforce.stackexchange.com/questions/140314/redirect-to-new-lightning-page-be-clicking-button-setting-parameters-to-compone

I hope this solution will help you. Please mark it as Best Answer so that it helps others too.
Thanks.
Deepali Kulshrestha