0

I am using:

window.location.replace('https://site.sharepoint.com/sites/ExternalSharing')

Also I tried using href.

The problem is that when I clicked on the button for redirection the new page is opened nested to the previous page.

$('#ok').on('click', () => {    
     window.location.replace('https://idikagr.sharepoint.com/sites/ExternalSharing');
})
  • Are you trying to do this in SPFx webpart? Or you can use some other webparts on your page to redirect users to another links. – Ganesh Sanap Sep 30 at 13:19
  • yes in spfx webpart – Aris Vang Sep 30 at 13:36
0

If your redirection URL is not dynamic then you can create a button like below:

<button type="button" onclick="parent.location='<redirection url>'">Click Here</button>

Or

<button type="button" onclick="location.href='<redirection url>';">Click Here</button>

You can find more answer in below link:

How to create an HTML button that acts like a link?

0

Finally, it works, I changed from true to false: on config/package-solution.json -> "isDomainIsolated": false.

0

Thanks Aris for your sharing, I have the same issue a few months ago, I put the window.location.href just in the render function, it won't redirect and finnally, I also change the isDomainIsolated to false and it solve the issue.

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.