css - 在 html 页面的容器中打开网站

标签 css html iframe webview

我基本上是想在另一个 html 页面中放置一个 html 框架。我尝试使用 iframe 打开以下站点,但没有帮助。请帮助我打开这个网站以及除了 iframe 之外的其他方式来做到这一点,我也希望稍后在 R 中重写 html 脚本,所以请建议遵循合适的方法。谢谢。

<!DOCTYPE html>
<html>
<body>
<base target="_blank">
<iframe>
src="google.com" height="200" width="300"
</iframe>
</body></html>

更新

<!DOCTYPE html>
<html>
    <body>
 <a href="http://www.google.com" target="_parent"><button>Click me !
  </button></a>
</body></html>

最佳答案

这是 syntax for iframe 的示例。

 <iframe  width="100%" height="100%" src="https://www.google.co.za/" frameborder="0" scrolling="auto" allowfullscreen>
 </iframe>

无法正确实现,因为框架中不允许使用 google。

这会起作用,例如:

 <iframe  width="100%" height="100%" src="https://www.rdocumentation.org/" frameborder="0" scrolling="auto" allowfullscreen>
 </iframe>

R 语法:

iframe(width, height, url_link) //syntax

iframe(width = "560", height = "315", url_link = "https://www.youtube.com/embed/0fKg7e37bQE") //example

这是 R 文档。 https://www.rdocumentation.org/packages/shinyLP/versions/1.1.0/topics/iframe

额外

阅读这篇关于从 google 添加自定义搜索的文章 Click Me

实现任何功能齐全的网站

要在浏览器的完整视角下使用 iframe,我会给您一个使用您的代码的示例:

还包括一个用于打开和关闭 iframe 的按钮标签。

$(document).ready(function() {
	$(".btn").click(function() {
		$("#frame").toggle();
	});
});
.btn {color: black; background-color: #eee; height: 50px; width: 200px; border-radius: 10px;border-color: #96bdd9;box-shadow: inset 0 1px 0 #f4f8fb; margin-bottom: 20px;outline: none;}
.test {position: fixed; width: 100%; height: 100%; }
.test iframe { width: 100%; height: 100%; border: none;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
<html>
<body>
<button class="btn" >Iframe Open & close</button>

<div class="test">
  <iframe id="frame" style="display: none;" width="100%" src="https://getbootstrap.com/" frameborder="0" scrolling="auto">
  </iframe>
</div>
 
</body>
</html>

关于css - 在 html 页面的容器中打开网站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48321074/

相关文章:

javascript - jQuery - .css() 不起作用?

html - 可变尺寸图像,在安装的居中元素内具有最大宽度/高度

javascript - 如何在 .aspx 页面加载时调整 IFRAME 的大小?

security - 在 iframe 中设置 cookie - 不同的域

html - 我想为这个标志制作动画,但由于某种原因它不起作用

javascript - Firefox Quantum 上的动画问题

php - 使变量术语在出现在另一个变量中时具有自己的 CSS

javascript - 使用 javascript 跟踪 iframe 的 http 请求

html - 为什么图像之间有间隙?

javascript - 如何发送查询请求而不刷新?