With IE 10 and Chrome 26 on Win7 x64 (Host1) no issues are appearing, except Firefox 20.
With IE IE 8 on Win7 x64 (Host2) and IE 10 on Windows Server 2012 x64 (Host3), there is the following issue I noticed with SharePoint 2013:
SCRIPT5007: Unable to get property 'showModalDialog' of undefined or null reference
and when I look into the code: SP.UI.ModalDialog
(for which I call: SP.UI.ModalDialog.showModalDialog(optDict);
) seems to be undefined
here. Only few properties of SP.UI
is available on Host2 and Host3, while on Host1 there are much more of these.
There is jQuery .click() event on some HTML element that triggers the function to display ModalWindow.
So it's as follows:
<script type="text/javascript">
$(document).ready(function() {
$("#some-a-element").click(function uploadMyFile(directory)) {
// something...
optDict = {
width: 800,
height: 500,
url: someUrl,
title: "Upload your file"
};
SP.UI.ModalDialog.showModalDialog(optDict);
// something else
});
// sumthing even here
});
// more code...
</script>
Looking for the solution over the internet, I've found out (in here) that this might be connected to lazy loading of SP.js and proper usage of ExecuteOrDelayUntilScriptLoaded
function should solve the issue.
So in my case it should be something like
ExecuteOrDelayUntilScriptLoaded(uploadMyFile, 'SP.js');
...I guess... Right?
However, I have no idea how to achieve this with .click() event handler presented above - and how to arrange it in this code structure. Tried few combinations that came into my mind, but without any success...
Any idea how to do so?