pdflist.html 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" >
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>本地网页</title>
  7. <style>
  8. body{margin: 0;}
  9. #pdfs{width: 100vw;height: 100vh;}
  10. #pdfs iframe{width: 100%;height: 100%;border: 0;}
  11. </style>
  12. </head>
  13. <body>
  14. <div id="pdfs">
  15. 加载中...
  16. </div>
  17. <script>
  18. function getQueryString(name) {
  19. let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  20. let r = window.location.search.substr(1).match(reg);
  21. if (r != null) {
  22. return unescape(r[2]);
  23. };
  24. return null;
  25. }
  26. let srcs = getQueryString('srcs');
  27. let srcList = srcs.split(',');
  28. console.log(srcList)
  29. let pdfs = document.getElementById('pdfs')
  30. let iframeHtml = '';
  31. srcList.forEach((src)=>{
  32. iframeHtml += '<iframe src="'+'./web/viewer.html?file='+src+'"></iframe>'
  33. })
  34. pdfs.innerHTML = iframeHtml;
  35. </script>
  36. </body>
  37. </html>