问题
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