I am calling below function 'Dialog' on button click from an app part on a sharepoint page but getting access denied error may be due to iframe's DOM access restriction. Is there any way around or another approach for opening a sharepoint page from an app part.
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;
}