0

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.

0

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 Apr 21 '15 at 9:10
  • yes, in your app, add window,location="/site/Homepage.aspx" on the button click – Nk SP Apr 21 '15 at 9:20
0

Here is the answer:

function exitClick(){
//replace your home page URL
window.parent.location.href="https://milesli.sharepoint.com/sites/DevSite";
}

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

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.