Wednesday, April 9, 2014

Redirect to an external website from SharePoint App


I’m assigned to a project where I’m to develop SharePoint hosted app using JSOM.

Problem Background

There I wanted to redirect to external web page. Eg. I used 

  • location.href=''; 
  • window.location.replace("");
  • document.location.href = url;
which we use normally to redirect to another website. But they didn’t work for me. This is because there was a post back on my page and I still want it.


I set a Timeout and it worked for me; use the below code to redirect.

  setTimeout(function () { document.location.href = url }, 20);


Hope this will help you. :) 

1 comment:

  1. it's not working...
    Sir i want to redirect it from a sharepoint content editor web part