You can reference a CSS or Style Sheet that is deployed in 15 hive in your SharePoint App using the Script below.
<script type="text/javascript">
var hostweburl;
(function () {
hostweburl =
decodeURIComponent(
getQueryStringParameter("SPHostUrl")
);
var scriptbase = hostweburl + "/_layouts/15/";
var dclink =
document.createElement("link");
dclink.setAttribute("rel", "stylesheet");
dclink.setAttribute("href", scriptbase + "defaultcss.ashx");
var head = document.getElementsByTagName("head");
head[0].appendChild(dclink);
})();
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>
0 comments:
Post a Comment