JSFiddle - React, Tailwind, and code Playground

by dshilkret

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Launch Adobe Reader</title>
</head>
<body>

    <button onclick="launchAdobeReader()">Open PDF in Adobe Reader</button>



</body>
</html>

JavaScript

function launchAdobeReader() {
            // Specify the URL of the PDF file you want to open

            //var pdfUrl =  "C:\Users\dshilkret\Discover Technologies(1)\ServiceNowDev1 - Dev1Lib1\INC0000009"
var pdfUrl = "https://dtecho365.sharepoint.com//sites/ServiceNowDev1/Dev1Lib1/INC0000001/i-9.pdf"

            // Try to open Adobe Reader using a custom URL scheme
            var adobeReaderUrl = 'acrobat:openUrl?file=' + encodeURIComponent(pdfUrl);
            console.log(adobeReaderUrl);

            // Create an invisible iframe and set its source to the Adobe Reader URL
            var iframe = document.createElement('iframe');
            iframe.style.display = 'none';
            iframe.src = adobeReaderUrl;
            document.body.appendChild(iframe);
        }