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