如何使用jQuery将外部网站加载到 <iframe>中?

要将外部HTML使用jQuery加载到<iframe>中,请使用attr()方法。在此设置iframe的来源。您可以尝试运行以下代码以了解如何查找外部HTML-

示例

<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
   $('#iframe').attr('src', 'https://www.qries.com');
});
</script>
</head>
<body>

<iframe id="iframe" name="myIframe" frameborder="5" width="500" height="300"></iframe>

</body>
</html>