我正在尝试使用其他网站的内容进入我的网站。我尝试在Jquery中使用DIV而不是iframe标记<iframe>。
我的密码:
<head>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js?ver=1.4'></script>
<script type='text/javascript'>
$(document).ready(function (){
$('#divframe').load('http://www.example.com');
});
</script>
</head>
<body>
<div id="divframe"></div>
</body>它没有返回任何价值,也没有在我的网站上显示example.com的内容。表示该页为空&空白。
编辑:我正在寻找不含iframe,object,embed标签的iframe解决方案。
请帮我把它修好:)
发布于 2021-12-26 17:06:32
为此,您需要使用iframe标记和attr()。
注意:您还需要确保该网站的网址不受保护,可以通过youtube.com、google.com等第三方网站框架加载。
https://en.wikipedia.org/wiki/Framekiller
$(document).ready(function (){
$('#divframe').attr("src", "https://wikipedia.org/wiki/Main_Page");
});<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<iframe id="divframe" style="width:100%;height:95vh"></iframe>
https://stackoverflow.com/questions/70484793
复制相似问题