The problem can be reproduced by putting a position: relative
style in the html
element of the page to be included in iframe
.
One of the solutions is to remove this style, but since sometimes you have no control over it, another solution is to add a style position: relative
to iframe
.
iframe {
position: relative;
}
Answered in the SO .
EDIT
It's worth remembering that when you open the PDF in your browser in a new tab, it uses some add-in to read the file, such as adobe reader.
A very easy way to use iframe
to display the PDF is to display it through Google Docs. You just need to change your src
to something like this:
http://docs.google.com/viewer?url=urlDoPDF&embedded=true
Change the url
parameter to your PDF url (localhost does not work, PDF must be online). Remember to escape the fields using some function, such as encodeURIComponent
of JS.
Example in JSFiddle .
Answer from another question in SO .