The main thing is the use of a jquery plug-in jquery.media.js, the use of this plugin is easy to implement.
Core code
HTML code
- <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
- <html xmlns= "http://www.w3.org/1999/xhtml" xml:lang="ZH-CN" dir="ltr">
- <Meta http-equiv= "content-type" content= "text/html; Charset=utf-8 "/>
- <title>online View PDF</title>
- <script type="Text/javascript" src= "http://sources.ikeepstudying.com/js/ Jquery-1.8.3.min.js "></script>
- <script type="Text/javascript" src="Jquery.media.js"></Script >
- <script type="Text/javascript">
- $ (function () {
- $ (' A.media '). Media ({width:800, height:600});
- });
- </Script>
- </head>
- <body>
- <a class="Media" href="guice.pdf">pdf File</a>
- </body>
- </html>
View preview: http://sources.ikeepstudying.com/jquery.media/pdf.php
With Jquery.media.js, you can directly open a link to a PDF file to meet your needs.
Project Address: http://jquery.malsup.com/media/
Article turned from: http://justcoding.iteye.com/blog/2163072
jquery Online preview pdf file, open PDF file (backwards compatible IE8, IE7)