Chrome Control (Navigation Control) on the Provider Hosted Application to go back to SharePoint Site
Today i have faced one issue. I have submitted my app into microsoft app store unfortunately my app has got rejected due to some reasons.
I would like to share one of those reasons here.
"Users to navigate back to SharePoint via chrome controls or something similar"
the below script needs to be pasted in the starting page of the app.
I would like to share one of those reasons here.
"Users to navigate back to SharePoint via chrome controls or something similar"
the below script needs to be pasted in the starting page of the app.
<script src="../Scripts/msajaxscript.js" type="text/javascript">
</script>
<script type="text/javascript" src="../Scripts/jquery-1.7.2.min.js">
</script>
<script type="text/javascript">
var hostweburl;
// Load
the SharePoint resources.
$(document).ready(function () {
// Get
the URI decoded app web URL.
hostweburl =
decodeURIComponent(
getQueryStringParameter("SPHostUrl")
);
// The
SharePoint js files URL are in the form:
//
web_url/_layouts/15/resource.js
var scriptbase = hostweburl + "/_layouts/15/";
// Load
the js file and continue to the
//
success handler.
$.getScript(scriptbase + "SP.UI.Controls.js")
});
//
Function to retrieve a query string value.
// For
production purposes you may want to use
// a
library to handle the query string.
function getQueryStringParameter(paramToRetrieve) {
var params =
document.URL.split("?")[1].split("&");
var strParams = "";
for (var i = 0; i < params.length; i = i + 1) {
var singleParam = params[i].split("=");
if (singleParam[0] == paramToRetrieve)
return singleParam[1];
}
}
</script>
On the body tag, add the div with name as follows
<div
id="chrome_ctrl_container"
data-ms-control="SP.UI.Controls.Navigation"
data-ms-options='{
"appIconUrl" :
"../Images/App.png",
"appTitle" : "Title
of the App"
}'>
</div>
Happy coding ... I would believe that this will helps you !!!
Comments
Post a Comment