Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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">

like image 529
Dr Manish Lataa-Manohar Joshi Avatar asked Mar 30 '15 14:03

Dr Manish Lataa-Manohar Joshi


1 Answers

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

like image 128
leLabrador Avatar answered Sep 22 '22 22:09

leLabrador