我在共享点页面上的应用程序部分单击按钮时调用下面的函数“对话框”,但出现访问被拒绝错误可能是由于 iframe 的 DOM 访问限制。是否有任何方法或其他方法可以从应用程序部分打开共享点页面。
function Dialog() {
hostweburl =
decodeURIComponent(
getQueryStringParameter('SPHostUrl')
);
appweburl =
decodeURIComponent(
getQueryStringParameter('SPAppWebUrl')
);
//alert(hostweburl);
//alert(appweburl);
var scriptbase = hostweburl + '/_layouts/15/';
$.getScript(scriptbase + 'SP.Runtime.js',
function () {
$.getScript(scriptbase + 'SP.js',
function () { $.getScript(scriptbase + 'SP.RequestExecutor.js', ShowServerInformation); }
);
}
);
}
function ShowServerInformation() {
var options = {
url: "/_layouts/Viewlsts.aspx&IsDlg=1",
tite: 'Server Information',
allowMaximize: false,
showClose: true,
width: 430,
height: 230
};
parent.SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
return false;
}