We have created a provider hosted app with few pages in it.Each page in the app has an exit button on it. This app is added on SharePoint pages as app part with different pages showing on each page.

Requirement is to navigate to site home page on Exit click. I have thought of following :

  1. Navigating in app code will only navigate in the iframe.
  2. content editor js will not be able to access the elements in iFrame.

Please suggest what options i have.

2 Answers 2


As you said, the app part is included as IFrame so the scope is the ifram itself.
A content editor script web part will not able to reache the IFrame.
You can simply add a JS script to the app and put your logic (so redirect to home page while clicking) in it.
With this solution you can also change the target url of the redirect without deploy your app again.

  • As i mentioned in my first point, a redirect in app will also redirect in the iframe only and URL will not change. I want to navigate to site home not app home
    – Mohit
    Commented Apr 21, 2015 at 9:10
  • yes, in your app, add window,location="/site/Homepage.aspx" on the button click
    – Nk SP
    Commented Apr 21, 2015 at 9:20

Here is the answer:

function exitClick(){
//replace your home page URL

<input type="button" value="exit" onclick="exitClick()"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.