PDF Viewer using object tag not working for Edge

后端 未结 3 1862
谎友^
谎友^ 2021-01-12 17:34

I am trying to show a PDF document inline using the object tag - it works as expected in Chrome and Firefox but isn\'t working in Edge.

Sample Code:



        
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-12 18:17

    I've faced a similar issue. Object tag behaves differently in IE and EDGE; the sever needs to accept the HEAD request made by the object tag (HEAD request : only in IE & EDGE) and give a response, then a get request is made to fetch the file. This is a limitation in Microsoft's browsers.

    Edit 1: This worked for me (EDGE and IE too) if I add the object tag html with the url in the data attribute to the dom instead of setting the attribute value, using javascript, of object tag which is already on the dom. Please note that I've a endpoint flushing response, this updates the value of data attribute.

提交回复
热议问题