|
|
- <html>
- <head>
- <meta
- name="viewport"
- content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"
- />
- <title>富文本展示</title>
- <style type="text/css">
- html,body {
- margin: 0;
- padding: 0;
- width: 100%;
- height: 100%;
- overflow: hidden;
- box-sizing: border-box;
- }
- .yingbing-content {
- color: #333;
- width: 100%;
- height: 100%;
- }
- .yingbing-img {
- max-width: 100%!important;
- max-height: 100%!important;
- }
- </style>
- </head>
- <body>
- <div class="yingbing-content"></div>
- </body>
- <script type="text/javascript">
- window.onload = function () {
- var search = window.location.search.slice(1);
- var arr = search.split('&');
- for ( var i = 0; i < arr.length; i++ ) {
- var strs = arr[i].split('=');
- if ( strs[0] == 'content' ) {
- document.querySelector('.yingbing-content').innerHTML = decodeURIComponent(strs[1])
- }
- }
- }
- function setFontFace (fontList) {
- let code = fontList.reduce((accumulator, currentValue) => {
- return accumulator + `@font-face { font-family: ${currentValue.fontFamily};src: url('${currentValue.src}'); }`;
- }, "");
- var style = document.createElement("style");
- style.type = "text/css";
- style.rel = "stylesheet";
- style.appendChild(document.createTextNode(code));
- var head = document.getElementsByTagName("head")[0];
- head.appendChild(style);
- }
- </script>
- </html>
|