I am using:


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', () => {    
  • 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 '19 at 13:19
  • yes in spfx webpart – Aris Vang Sep 30 '19 at 13:36

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

| improve this answer | |
  • You only had to do that? Im having the same issue, but event with isDomainIsolated to false I'm being redirect into a nested page. Any clues what else needs to be in place? – André Alves Mar 18 at 18:59
  • Answering myself, as the solution deployed with this setting true, it was needed to completely remove the app from the App Catalog and generate a new version of the solution. Reference: sharepointnutsandbolts.com/2019/04/… – André Alves Mar 18 at 20:23

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>


<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?

| improve this answer | |

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.

| improve this answer | |

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.