简体   繁体   中英

google scripts/html trying to display page within page

First I am going to show my code, this is my html code that's running:

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

And this is my css file:

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

I also have two more files to run the code and apply the css file, which I am pretty sure is not the issue. This first one is a gs file which is a form of js the code starts at doGet

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

and the other one which is html:

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

Okay now the question. The current result is just a blank page, and its not even printing the text. so far i haven't tried anything that led to much success, so far i have worked on the css file to try to fix it. I have done research, but couldn't find much on google scripts. the goal of the code is to display google homepage inside of the site, I have been deploying it as a web page. This my first post If you have questions I could answer or test for please let me know

I know this doesn't solve your blank page scenario directly, but if you're interested in nesting another site within yours perhaps you'd be interested in using an iframe instead?

Here's a generator . Try punching in google.com and see if you can embed it in your site.

Your code looks a bit messy by how it's provided so for demo purposes I made my own. If you want to "embed" google.com first page to your site then use iframe but instead of using google.com try to use this link => https://www.google.com/webhp?igu=1 otherwise it will show nothing.

PS To preview code use full-page mode.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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