Javascript 如何使用嵌入式google演示文稿自动重新加载iframe?
我使用以下代码:Javascript 如何使用嵌入式google演示文稿自动重新加载iframe?,javascript,iframe,Javascript,Iframe,我使用以下代码: <!DOCTYPE html> <html> <head> <title>Example</title> </head> <body> <script> window.setInterval("reloadIFrame();", 3000); function reloadIFrame() {
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
</head>
<body>
<script>
window.setInterval("reloadIFrame();", 3000);
function reloadIFrame() {
document.getElementsByName("testFrame")[0].contentWindow.location.reload();
}
</script>
<iframe name="testFrame" src="https://docs.google.com/presentation/d/1jkNVBxAX57PjfxTNTkgO8zNnMFYoKUqUKQ4aJk8pCIs/embed?start=true&loop=true&delayms=5000" width="760px" height="920px"></iframe>
</body>
</html>
例子
setInterval(“reloadIFrame();”,3000);
函数重载框架(){
document.getElementsByName(“testFrame”)[0].contentWindow.location.reload();
}
它在一些网站上运行良好,但不适用于这个谷歌展示。。我应该更改什么以使其正常工作?您可以尝试此操作,否则您将遇到跨源问题:
document.getElementsByName("testFrame")[0].src="https://docs.google.com/presentation/d/1jkNVBxAX57PjfxTNTkgO8zNnMFYoKUqUKQ4aJk8pCIs/embed?start=true&loop=true&delayms=5000";
关于您可以改为尝试此操作,否则将出现跨来源问题:
document.getElementsByName("testFrame")[0].src="https://docs.google.com/presentation/d/1jkNVBxAX57PjfxTNTkgO8zNnMFYoKUqUKQ4aJk8pCIs/embed?start=true&loop=true&delayms=5000";
关于请看这篇文章:请看这篇文章: