javascript - 如何解决 CSS 没有反映在 Air-Table 的 iframe 上的问题?
问题描述
我正在尝试在 Air-Table iframe 中添加 CSS 属性,但 CSS 没有反映。
代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<iframe class="airtable-embed" id="calender" src="https://airtable.com/embed/shriqTxajodBzOTYb?backgroundColor=teal&viewControls=on" frameborder="0" onmousewheel="" width="100%" height="533" style="background: transparent; border: 1px solid #ccc;"></iframe>
</body>
</html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
$('#calender').on('load', function() {
$("iframe").contents().find("#embedBottomBarContainer").css("display", "none");
});
});
</script>
解决方案
如果我没记错的话,你只能影响 IFrame 的样式,如果它来自与你的网站相同的服务器,因为同源策略。
所以这可能就是问题所在。您正在尝试更改不同来源 IFrame 的样式
推荐阅读
- python - 初学者:Python 找不到“pyodbc”包?
- c - Win32 上的异步串行 I/O -- 如何创建警报事件
- php - 在接受 cookie 同意之前替换所有 youtube iframe
- java - 我需要从 List 的字符串中迭代数据,并从以下 JSON 的“MemberOf”参数中添加到另一个列表字符串中
- java - 检查月、日或年是否在两个日期的范围内
- scala - 如何从 sbt 的动态任务中检测当前项目是否是根项目?
- node.js - node.js + express ,分隔文件和中间件中的路由器仅在某些路由之前?
- c# - 带有 Caliburn Micro wpf 的多个模板 TreeView
- sql-server - 填充同一报告中的第二个表以计算从第一个表中的 CASE 派生的相同值
- java - IntelliJ,无法启动简单的 Web 应用程序:无法在 localhost:4848 ping 服务器