简体   繁体   中英

Very technical- Modal takes time to load. How to reduce the load time?

I have a file with a span "Click to open dialog". It opens the web page in modal view. The web page is mentioned in the url part below var perlURL="..../cgi-bin/test/web_editor.pl";

Please note that it is a perl file with grid data in it. So a lot of javascripts and data.

My query is- when i click on the dialog "Click to open dialog", it takes around 7 minutes to load the entire perl file into the modal.

can anyone share how can i reduce the loading time. If i use the basic html file, it loads instantaneously. However this perl file of 1200 lines of code, take 7 seconds to load in the modal. Please shed some light on how to improve loading time here.

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <script type='text/javascript' src='http://code.jquery.com/jquery-1.7.1.js'></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js"></script>
    <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/themes/base/jquery-ui.css">

    <script>
      $(function() {
        var dialogW = 1130;
        var dialogH = 700;

        $( "#dialog" ).dialog({
          autoOpen: false,
          modal: true,
          title: '',
          width: dialogW,
          height:dialogH,
          draggable: true,
          resizable: true
        });

        $( "#opener" ).click(function() {
          $("#dialog").html("<span>Loading...</span>").dialog("open");
          var perlURL=".../test/web_editor.pl";
          $("#dialog").load(perlURL);
        });
      });
    </script>
  </head>

  <body>
    <span style="cursor:pointer" id="opener" >Click to Open Dialog </span>
    <div id="dialog" title="">  </div>
  </body>
</html>

Open your Perl code, run it separately outside the modal and determine the load time there. Most likely it is poor performance in the Perl code and based on your details above, i would start with the calls made to the data sources that read the data. Could be bad performance in the script that reads the data, or network performance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM