问题
In IE currently anchor linking to a section on a PDF only works if the PDF in question is cached or has been downloaded recently on the user's computer.
Example
User clicks anchor link to pdf first time
PDF loads at the beginning of document
User goes back to website and clicks link again
PDF loads at anchor linked position
Does anyone know of a work around in which the PDF will load at the desired position upon first clicking the link?
Note that the anchor links are of the type #page=200
and fit these guidelines http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf
回答1:
Here is my current solution, while not perfect it works.
<div class="hidden" id="iframes"></div> //-- hidden div at bottom of page
$(function() {
var urls = ["url one", "url two", "etc..."];
$(urls).each(function(index, url) {
var iframe = $("<iframe />").attr({ src: url });
$("#iframes").append(iframe);
});
});
来源:https://stackoverflow.com/questions/4997017/anchor-link-pdf-work-around