0

I have this HTML (attached). It is called by a web app that still works on I.E (for at least one or two months) due to some problems we have with the vendor. The web app calls this HTML and it is opened in I.E also. I need this HTML to be opened in Chrome. Is there a way i can do this by adding something to the HTML itself?

    <html>        
    <head>        
    <script>     
    async function setSRC(){
    try{
    var xhr;
    const params = new Proxy(new URLSearchParams(window.location.search), 
   {
          get: (searchParams, prop) => searchParams.get(prop),
    });
    
    var docId = params.docId;
    var url = "``http://wsp-exttest.lcardtest.corp:4440/rest.oms/MaxRestService/getPDF?docId=``" + docId;
    
    let response = await new Promise(resolve => {
    xhr = new XMLHttpRequest();
    xhr.open("GET", url, true);
    xhr.onload = function(e) {
    resolve(xhr.response);
    };
    xhr.onerror = function () {
    resolve(undefined);
    console.error("** An error occurred during the XMLHttpRequest");
    };
    xhr.send();
    })
    //
    var j = JSON.parse(xhr.responseText);
    var pdfData = j[0].content;
    
    var letterFrame = document.getElementById("letterFrame");
    letterFrame.src = "data:application/pdf;base64," + pdfData;
    
    /*letterFrame.onreadystatechange = () => {
    if (letterFrame.readyState === 'complete') {
    alert(letterFrame.readyState);
    letterFrame.src = "data:application/pdf;base64," + pdfData;
    }
    };*/
    
    }
    catch(e)
    {
    if(confirm("Load faile: " + e.message + "click ok to retry"))
    setSRC();
    }
    }
    </script>
    
    </head>
    
    <body onload="setSRC()">
    
    <iframe id="letterFrame" width="1200px" height="800px" onload=""></iframe>
    
    <a href="javascript:setSRC()">Reload</a>
    
    </body>        
    </html>   
<a href="javascript:setSRC()">Reload</a>
Damini Suthar
  • 1,470
  • 2
  • 14
  • 43
Tal
  • 1
  • 1
  • So the situation is that this HTML document is being opened in Internet Explorer and you want to open it in Chrome instead? – glenatron Apr 06 '22 at 15:55
  • Yes, even though the calling webapp runs on I.E – Tal Apr 07 '22 at 06:20
  • Does this answer your question? [Can I force a link to open in a specific browser?](https://stackoverflow.com/questions/5881383/can-i-force-a-link-to-open-in-a-specific-browser) – glenatron Apr 07 '22 at 08:52
  • In that case I think even though you're going between different browsers this is probably a duplicate of this question: https://stackoverflow.com/questions/5881383/can-i-force-a-link-to-open-in-a-specific-browser - note the answer that suggests Edge- that might be a viable alternative to chrome as it's the same rendering engine IIRC and IE might support that link scheme better. – glenatron Apr 07 '22 at 08:54

0 Answers0