Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open PDF from Chrome IFRAME failed with default PDF viewer

The code looks like:

    <iframe pm-attr-iframe class="widget-body" ng-src="{{vm.iframeUrl}}"  sandbox="allow-same-origin allow-popups allow-forms allow-top-navigation">
    (not available)
</iframe>

Click the PDF link inside the iframe, it opens with white content. If right click the mouse and click "Save", it works.

If open the URL to any tab or window, the PDF file rendered with default PDF viewer.

If I add other PDF viewer to Chrome extensions, it always works.

Is it caused by default PDF viewer of Chrome? How to avoid it?

like image 811
Tom Avatar asked Oct 26 '25 04:10

Tom


1 Answers

I just found another way to fix this. If your site needs to stick with sandbox for some reason, you can add the value allow-popups-to-escape-sandbox to fix this issue.

like image 93
Thuan Phan Thanh Avatar answered Oct 28 '25 17:10

Thuan Phan Thanh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!