Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
1.6k views
in SharePoint Online by 2 2 4

I used the following script to produce the modals. It takes long seconds for the page content to show in the modal. Any ideas to speed up load time would be appreciated.
Or maybe a message letting visitors know that the content is loading.

function openDialog(pageUrl) { 
var options = 
{ url: pageUrl, 
title: ' ', 
allowMaximize: false, 
showClose: true, 
width: 726, 
height: 375,
}
 SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options); 
}

I use this to call the 6 modals on the page

<a href="#" onclick="openDialog(pageURL);">​Link Text</a>

Thanks


1 Answer

0 like 0 dislike
by 163 204 403
selected by
 
Best answer

I tried the same code on my side that worked properly without a slowness issue!
So what I can see is the load time mainly depends on the URL content that you tried to load or there is another issue depending on other code on your page affecting the loading time!

So my suggestions to investigate your issue are:

  1. In SharePoint Modal Pop-up dialog function, try to load another URL to ensure that the issue is not mainly related to the provided URL.
  2. Create a new page that doesn't have other code or web parts and try to add a script editor with the below code!

Open link in Modal Dialog SharePoint 2019

See also Open link in Modal Dialog SharePoint 2019

by 2 2 4
1 0
In following your suggestion, I found that removing the width and height helped with loading. Not sure why. Thanks for pointing me in the right direction.
by 163 204 403
0 0
You're welcome and glad to hear it helped you!
If you don’t ask, the answer is always NO!
...