为了账号安全,请及时绑定邮箱和手机立即绑定

google scripts/html 试图在页面中显示页面

google scripts/html 试图在页面中显示页面

侃侃无极 2023-05-25 17:07:23

首先我要展示我的代码,这是我正在运行的 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 文件上工作以尝试修复它。我做过研究,但在谷歌脚本上找不到太多。代码的目标是在网站内部显示谷歌主页,我一直将其部署为网页。这是我的第一篇文章如果您有任何问题我可以回答或测试请告诉我


查看完整描述

2 回答

?
慕勒3428872

TA贡献1682条经验 获得超4个赞

你的代码看起来有点混乱,因为它是如何提供的,所以为了演示目的,我自己做了。如果您想将 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>


<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>


查看完整回答
反对 回复 4天前
?
不负相思意

TA贡献1609条经验 获得超10个赞

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

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


查看完整回答
反对 回复 4天前
  • 2 回答
  • 0 关注
  • 5 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信