How to disable pop-out option in pdf viewer with google doc iframe?

10,159

Can use sandbox to stop the popup working inside iframe

<iframe 
    sandbox="allow-scripts allow-same-origin"
/>

allow-scripts: to run javascript inside iframe.
allow-same-origin: to allow loading file from google viewer.
without allow-popups, nothing will happen when users click on pop-out icon.

Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe

Share:
10,159
Dr Manish Lataa-Manohar Joshi
Author by

Dr Manish Lataa-Manohar Joshi

I Am An AYURVEDIC Doctor Practicing In India Since last 21 years. I am very much fond of computer and website designing. I didn't go through any computer class or course till date. but designing and coding website with the help of google and great sites like this one i.e. stackoverflow.com

Updated on July 26, 2022

Comments

  • Dr Manish Lataa-Manohar Joshi
    Dr Manish Lataa-Manohar Joshi almost 2 years

    I am using following code to display pdf using google with iframe.. It's working fine. But I want to disable "pop-out" option (which on click opening my pdf in new tab with google docs) shown on right upper corner beside zoomin option on my webpage. Is it possible?

    Currently I am using following code -

    <iframe src="http://docs.google.com/gview?url=http://example.com/files/myfile.pdf&embedded=true" style="width:600px; height:500px;" frameborder="0">