Skip to content

JavaScript window extension

In addition to the "exeoutput" JavaScript object available in ExeOutput apps, ExeOutput for PHP extends the window object, especially to deal with secondary windows or pop-ups.

Tip

The following examples can be tested in the Secondary Windows and Popups topic of the General Demonstration.

The following commands are available:

window.open

window.open() is fully supported. You can also name your pop-ups and then identify or manipulate them with JavaScript.

For example:

<script>
  $(function() {

    $("#btn").click( function()
    {
        window.open('samples/testpopup.php', 'Popup');
    }
 }
</script>

window.exportPDF

window.exportPDF(pdffilename) is a JavaScript extension available in ExeOutput apps. This function allows you to export the content of the window as a PDF file.

pdffilename lets you pass the full path and filename of the PDF file to be exported.

For example:

<script language="javascript">
   // Callback for the save dialog box - content contains the full path to the future PDF file.

    function DemoSavePDF(content) {
            if (content === "") return;
            window.exportPDF(content);
        }

    function exportpdf() {
        // Run HEScript script SavePDFDlgFile defined in UserMain to get the PDF filename.
        exeoutput.GetHEScriptCom('hescript://UserMain.SavePDFDlgFile', DemoSavePDF);
        }

</script>

window.moveTo and window.resizeTo

window.moveTo() and window.resizeTo() are also supported.

Here is an example of displaying a fullscreen window:

 function showmaxpop()
      {
      var w = window.open('about:blank', 'Report', "fullscreen");
      w.document.open();
      w.document.write('Hello large popup');
      w.document.close();
      w.moveTo(0,0);
      w.resizeTo(screen.availWidth, screen.availHeight);
      }

See these topics also:

The JavaScript exeoutput object

How to call HEScript procedures/functions in JavaScript?