繁体   English   中英

谷歌脚本/html试图在页面内显示页面

[英]google scripts/html trying to display page within page

首先我要展示我的代码,这是我正在运行的 html 代码:

<!DOCTYPE html>
<html>
    <head>
    <title>Elliots Site</title>
    <base target="_top">
    <?!= include('Gcss'); ?>
      <script type="text/javascript">
       
      </script>
    </head>
    <body>
    <div class="page">
      <iframe style="width: 100%; height: 100px; overflow: hidden;" src="http://google.com" width="100" height="100" scrolling="no">Iframes not supported</iframe>
      <h1 class="emoj">"😀"</h1>
     </div> 
        <?!= include('Gjavascript'); ?>
    </body>
</html>

这是我的 css 文件:

<style>
    /* CSS reset */
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td { 
    margin:0;
    padding:0;
}
      html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Roboto', sans-serif;
  font-weight: 100;
}

.page iframe {
vertical-align:center;
width=200%;
height=100%;
}
.page .emoj {
text-align:center;
color:auto;
vertical-align:center;
}
.page{
background-color:white;
align-items: center;
height:400px;
background-attachment: fixed;
background-repeat: no-repeat;
text-align:center;
}
<style>

我还有两个文件来运行代码并应用 css 文件,我很确定这不是问题。 第一个是一个 gs 文件,它是一种 js 形式,代码从 doGet 开始

function doGet() {
return HtmlService.createTemplateFromFile('gindex')
.evaluate();
}
function include(filename) {
  return HtmlService.createHtmlOutputFromFile(filename)
  .getContent();
}

另一个是 html:

<!DOCTYPE html>
<script>
window.addEventListener('load', function() {
  console.log('Page is loaded');
});
</script>

好的现在问题。 当前结果只是一个空白页,甚至没有打印文本。 到目前为止,我还没有尝试任何可以取得很大成功的方法,到目前为止,我一直在研究 css 文件以尝试修复它。 我做了研究,但在谷歌脚本上找不到太多。 代码的目标是在网站内显示谷歌主页,我一直将其部署为网页。 这是我的第一篇文章如果您有问题我可以回答或测试,请告诉我

我知道这并不能直接解决您的空白页面情况,但是如果您有兴趣在您的网站中嵌套另一个网站,也许您会对使用iframe感兴趣?

这是一个发电机 尝试在google.com打卡,看看是否可以将其嵌入您的网站。

你的代码看起来有点乱,所以为了演示目的,我自己做了。 如果您想将 google.com 第一个页面“嵌入”到您的网站,请使用 iframe 但不要使用 google.com 尝试使用此链接 => https://www.google.com/webhp?igu=1否则它会什么都不显示。

PS 要预​​览代码,请使用整页模式。

 .frame { height: 700px; width: 600px; } .page { text-align: center; } body { background-color: grey; height: 100vh; overflow: hidden; }
 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>IRONIXX</title> </head> <body> <section class="page"> <h1 class="emoj">"😀"</h1> <iframe class="frame" src="https://www.google.com/webhp?igu=1" frameborder="0"></iframe> </section> </body> </html>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM