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

强颜欢笑 提交于 2019-12-06 23:15:54

问题


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


回答1:


Run this javascript (sample with jQuery) on your page (I assume the class is the same for all clients)

$('.ndfHFb-c4YZDc-Wrql6b').remove();



回答2:


The following solution is useful to remove preview button. Add this code onload function of your iframe. It's applied after iframe is loaded.

var head = $("#iframe").contents().find("head");
var css = '<style type="text/css">' +
          '.ndfHFb-c4YZDc-Wrql6b{display:none}; ' +
          '</style>';
$(head).append(css);


来源:https://stackoverflow.com/questions/29349556/how-to-disable-pop-out-option-in-pdf-viewer-with-google-doc-iframe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!