5 Replies Latest reply on Mar 12, 2014 1:26 PM by George_Johnson

    How do I detect device using javascript?

    praveenwdm

      Is it possible to detect that PDF file is being viewed in which type of device i.e. mobile, pc, tab etc?

        • 1. Re: How do I detect device using javascript?
          try67 MVP & Adobe Community Professional

          No. You can find out in which application its viewed and on what platform

          (Windows/Mac/Unix), but that's about it, and even that might not work

          correctly on mobile devices.

          • 2. Re: How do I detect device using javascript?
            praveenwdm Level 1

            Thanks for your answer.

            I just wanted to know that if I write some javascript code/functionality which will run in a pdf file when opened/viewed in a PC and if the same file is viewed using adobe reader in mobile device say e.g. in adobe reader app of Android, will all the javascript functionality work properly for the mobile device as well? Or is there any alternative solution? Actually, I want to track some user actions like on which pages the user visited and for how much time for each page etc. Also, I want this thing to be happened whether the PDF is viewed in pc, mobile or tab. Could you help me to figure out which things are possible among these and which are not?

             

            Thanks

            • 3. Re: How do I detect device using javascript?
              George_Johnson MVP & Adobe Community Professional

              That depends on which device, which PDF viewer, and how the code is triggered. The app.platform property can be used (returns "iOS" and "Android") with Adobe Reader for iOS and Android (in some scripts), and certain other PDF viewers (return value may be different) that have support for JavaScript. Not all JavaScript that's supported on the desktop versions of Adobe Reader will work on the mobile versions. Here is a link to some documentation: http://www.adobe.com/devnet-docs/acrobatetk/tools/Mobile/js.html  Be prepared for it not to be entirely accurate.

               

              You pretty much have to test yourself to find out what various mobile viewers support. Some non-Adobe implementations (e.g., PDF Expert on iOS) have much more support than others.

              1 person found this helpful
              • 4. Re: How do I detect device using javascript?
                praveenwdm Level 1

                Thanks George for the info. Actually, I had looked into that doc but wasn't sure about it.

                One more question. Can I get MAC address of the system where PDF is being viewed through JavaScript code so that I could ensure that the same file is viewed by different persons. If not possible via MAC. Is there any alternative for it?

                • 5. Re: How do I detect device using javascript?
                  George_Johnson MVP & Adobe Community Professional

                  You can't get the MAC address, and Adobe Reader for mobile devices don't yet support submitting, unless it's to FormsCentral, so what you're wanting to do really isn't possible.