3 Replies Latest reply on Sep 18, 2008 5:45 AM by Patrick Leckey

    How to close a PDF doc opended in IE web browser using JavaScript?

    Level 1
      Hi,

      I am using a document level javaScript. It works fine when document is opened in Acrobat but does not function propely when the samd pdf document is opened in IE web browser.

      The script is here:

      /* Document level script MAMValidityChk added using adscript Sequence Name addMAMValidityCheck use for MAM CD version only Last updated on 26-May-2008 */

      /* Dont forget to change MAM Version Year and Expiry Date */

      /* Functionality: Check MAM Expiry, if MAM has expired, display MAMExpMsg and close doc, otherwise display MAMOKMsg */

      /* function ExpiryCheck code */

      function ExpiryCheck() {


      // Get the current system date and time


      var rightNow = new Date();

      // Setup MAM Exp Date

      // MAM Expiry date and version info will be updated every quarter by the MAM Issuer
      /* Dont forget to change MAM Version Year */


      var expDate = new Date("September 30, 2008 23:59:59");

      // If Expired give warning, close the document

      if(rightNow > expDate) { // Expiry check condition

      /* MAMExp window code */
      /* Dont forget to change MAM Expiry Date */


      app.alert("This version of MAM has expired on 2008-Oct-01. Current version is accessible from the Source.\n\n For further information, please contact:\n\nXYZ, \nAdministrative Assistant, Engineering\nPh: 1-800-###-#### ext. ###\nEmail: xyz@yahoo.com\n\n\nFile will be closed.", 1, 0,"Testing Manual Ver. 2008");

      // If MAM has expired, the close command will close the file activate only in the final script

      this.closeDoc();
      } // end of if
      else
      { //start of else statement

      // If not expired, display MAMOK window

      /* MAMOK window code */
      /* Dont forget to change MAM Version Year */


      app.alert("This controlled document has been approved and signed by:\n\nXYZ\nManager, Testing Services\nABC Limited,\n\nNote: Any page(s) printed from this file will be marked uncontrolled automatically.\n\nPlease discard expired CD/documents promptly.",3,0,"Testing Manual Ver. 2008");

      } // end of else statement
      } // end of ExpiryCheck function


      // execute ExpiryCheck Function

      ExpiryCheck();

      /* end of MAMValidityChk script */

      When pdf document containing this script is opened in browser, it cheks the validity, gives warning BUT DOES NOT CLOSE THE DOC.
      Is there any way around close either the document or web window?

      Thanks.
      M. Ahmad