飞流 发表于 2024-12-8 03:08:15

discuz论坛编辑器发帖时增加嵌入网页功能

直接在帖内调用其他网页,可设置网址白名单,兼容手机端;
白名单以外网页会在顶部提示“此页面为外部引用,非本站内容,请谨慎访问。”,白名单内的网址则不会显示,白名单可设置多个网址。
教程如下:
打开后台=》界面=》编辑器设置=》discuz! 代码,新增一行代码,标签填 weburl ;
保存一下,点击详情打开配置,替换内容处填写下方代码;
<style>@media (max-width: 720px){.weburl{max-height: 350px !important;;}#bottom-notice {width: calc(100% - 4px) !important;}}#iframe-container {position: relative;/*width: 100%;height: 500px;*/}#bottom-notice{position:absolute;top:2px;left:2px;width:100%;background-color:#0000007d;color:#fff;text-align:center;z-index:1000;border-radius:8px 8px 0 0;font-size:12px;height:18px;line-height:18px;-webkit-backdrop-filter:saturate(180%) blur(6px);backdrop-filter:saturate(100%) blur(2px)}</style>
<div id="iframe-container"><iframe frameborder="0" height="500" width="100%" src="{1}" class="weburl" style="border: 2px solid #03A825;border-radius: 10px;"></iframe><div id="bottom-notice">此页面为外部引用,非本站内容,请谨慎访问。</div></div>
<script>const whitelistDomains=['www.humaimai.com','www.uzhix.com'];document.addEventListener('DOMContentLoaded',function(){const iframe=document.querySelector('.weburl');const src=iframe.src;const domain=new URL(src).hostname.replace(/^www\./,'');if(whitelistDomains.includes(domain)){document.getElementById('bottom-notice').style.display='none'}else{}});</script>
(请将代码中的“白名单网址”替换为实际的域名)

四哥 发表于 2024-12-13 16:21:37

路过看看                                       

发表于 2024-12-15 19:12:52

66666666666666

沃博 发表于 2024-12-18 20:20:12

愿留在Minecraft,也不愿回到现实。
页: [1]
查看完整版本: discuz论坛编辑器发帖时增加嵌入网页功能