其他

在某些应用的内置浏览器中浏览任意网页

小永***Lv.5 金牌会员 发表于 2024-6-6 · 最后回复 2025-9-24 IP:广西 3,080 3
本帖最后由 小永高呐 于 2024-6-6 08:49 编辑

在后台创建一个叫index.html的网页,粘贴如下代码入内保存,之后在可以打开网址的应用输入你主机的网址(或者用我这的demo也行),就可以去浏览任意网页了
蛮早之前码的代码,蛮乱的,不过能用,也没啥依赖项
演示demo:https://pic-tc.pages.dev/xiaoyonggaoya/website

  1. <html>
  2. <head>
  3. <title>网页浏览器</title>
  4. <style>
  5. body{margin:0;padding:0}
  6. #misha {position: fixed;top: 10px;right: 10px;width: 80px;height: 40px;background-color: #88888899;border: none;font-size: 20px;border-radius:8px;} /* 打开菜单按钮 */
  7. #liuying {position: fixed;top: 60px;right: 10px;width: 300px;height: 230px;background-color: #ffffff99;border: 1px solid black;display: none;border-radius:4px;} /* 界面 */
  8. #hanya {margin: 10px;width: 280px;border-radius:3px;} /* 网址栏 */
  9. #tingyun {margin: 10px;width: 80px;height: 40px;background-color: #00FF9999;border: none;border-radius:8px;} /* 访问/刷新按钮 */
  10. #zhigengniao {margin: 10px;width: 80px;height: 40px;background-color: #FF000099;border: none;border-radius:8px;} /* 关闭菜单按钮 */
  11. #iframe {width: 100%;height: 100%;border: none;} /* iframe自适应全屏 */
  12. div {-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;}
  13. button {-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;}
  14. </style>
  15. <base target="_self">
  16. </head>
  17. <body>
  18. <button id="misha" onclick="tuopa()">菜单</button>
  19. <div id="liuying">
  20. <div>请在下面框中输入网址以访问网站</div>
  21. <input id="hanya" type="text" placeholder="输入网址以访问网站" value="https://www.bing.com">
  22. <button id="tingyun" onclick="guinaifen()">访问/刷新</button>
  23. <button id="zhigengniao" onclick="buruoniya()">关闭菜单</button>
  24. </div>
  25. <iframe id="iframe" src="https://www.bing.com" allow="fullscreen" allowfullscreen="true"></iframe>
  26. <script>
  27. function tuopa() {document.getElementById("liuying").style.display = "block";} // 菜单打开
  28. function buruoniya() {document.getElementById("liuying").style.display = "none";} // 菜单关闭
  29. function guinaifen() {var url = document.getElementById("hanya").value;document.getElementById("iframe").src = url;} // 网址访问/刷新
  30. window.onload = function() {tuopa();} // 让页面加载时展开菜单
  31. </script>
  32. </body>
  33. </html>
复制代码
回复 3 最早 最新 只看楼主
林***Lv.3 中级会员
2024-6-6 08:50:14 · 来自手机 IP:湖南省
本帖最后由 一只晨月鸭 于 2024-6-6 13:38 编辑

方法不错,就是访问的时候比例不太对
这里我提醒一句
这样可能会动了某些人的蛋糕
某些付费防红的短链接就是这种方法访问的
2# 2024-6-6 08:50:14 回复 收起回复
Meow***Lv.5 金牌会员
2024-6-6 10:17:58 · 来自手机 IP:贵州省
手机访问很难受,建议把下面这个代码加入
  1. <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
复制代码

我加了这行可以看看(点击查看)
3# 2024-6-6 10:17:58 回复 收起回复
您需要登录后才可以回帖 登录 | 立即注册
本版积分规则