专注于免费网站建设领域,为诸多企业免费创造了一个个行业标杆网站,助力网民变访客,访客变顾客,共迎更伟大、更具机遇的未来。

您现在的位置: 首页>>免费教程>>建站教程

iframe套壳别的网站,实现站中站网页

来源:本站 发布时间:2023-10-16热度:2128 ℃
如果你有个域名和服务器,但是你又想要目标网站的内容,可以选择套壳,用html的iframe标签实现。代码如下<!DOCTYPEhtml><htmllang="zh"···

如果你有个域名和服务器,但是你又想要目标网站的内容,可以选择套壳,用html的iframe标签实现。

代码如下:

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link rel="stylesheet" href="main.css">

<title>31免费建站:www.31jz.com</title>

<meta name="keywords" content="31免费建站网" />

<meta name="description" content="31免费建站网">

<link rel="shortcut icon" href="https://www.31jz.com/favicon.ico" type="image/x-icon">

<style>

    body {

      margin: 0;

      padding: 0;

    }

    #myiframe {

      width: 100%;

      height: 100vh;

      border: none;

    }

  </style>

  <script>

    function changeFrameHeight() {

      var ifm = document.getElementById("myiframe");

      ifm.height = document.documentElement.clientHeight;

    }

    window.onresize = function() {

      changeFrameHeight();

    };

</script>

</head>

<body>

<iframe src="https://www.31jz.com" id="myiframe" scrolling="yes" onload="changeFrameHeight()" frameborder="0"></iframe>

</body>

</html>

说明一下

以上代码实现,自动适配屏幕缩放。

无边框,带滚动

自动适配目标网址的SSL.

再最下方的iframe src=后方替换自己的目标网址即可


本文地址:https://31jz.com/jzjc/1132.html