0

I recently started a new project on Google Script . The problem is when i tried to embed my project to the website as a iFrame i'm getting error which is said the website refused to connect. But when i click to direct google drive link it works fine . Only problem here is the website doesn't properly runs the script.

Error message which is saying The Website is refusing to connect in Turkish

<!DOCTYPE html>
<html>

<head>
  <base target="_top">
  <!--Import Google Icon Font-->
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  <!-- Compiled and minified CSS -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">


  <!--Let browser know website is optimized for mobile-->
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />

</head>
<div class="container">

  <div class="row">
    <div class="input-field col s12">
      <input id="email" type="email" class="validate">
      <label for="email">Eposta Adresiniz</label>
    </div>
  </div>

  <div class="row">
    <div class="input-field col s12">
      <input id="password" type="password" class="validate">
      <label for="password">Şifreniz</label>
    </div>
  </div>

  <div class="row">
    <div class="input-field col s12">
      <button class="btn waves-effect waves-light" id="btn">Bilgileri Getir
          <i class="material-icons right">send</i>
          </button>
    </div>
  </div>
  <!--END ROW-->

</div>

<body>
  <!-- Compiled and minified JavaScript -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>

  <script>
    var epostaBox = document.getElementById("email");
      var sifreBox = document.getElementById("password");
      document.getElementById("btn").addEventListener("click",addRecord);

      function addRecord(){
        var postam = epostaBox.value;
        var sifre = sifreBox.value;
        if(postam.trim().lenght == 0 || sifre.trim().lenght == 0){
          M.toast({html: 'Eposta Boş Geçilemez'});
        }else{
          var Bilgi ={
          epostam: epostaBox.value,
          sifrem: sifreBox.value,
          };
        M.toast({html: 'Bilgiler yükleniyor...'})
          google.script.run.appendData(Bilgi);
        }; //if bloğu kapandı
      } //veri gönderme bloğu kapandı

      function doGet() {
        return HtmlService.createTemplateFromFile('form.html')
        .evaluate() // evaluate MUST come before setting the Sandbox mode
        .setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
        }

  </script>
</body>

</html>

GOOGLE APP SCRIPT

function showUserForm() {
  var template = HtmlService.createTemplateFromFile("userform");
  var html = template.evaluate();
  html.setTitle("Anket Sonucu Görme Uygulaması Bilgi Girişi");
  SpreadsheetApp.getUi().showModalDialog(html, "Anket Sonucu Görme Uygulaması Bilgi Girişi");//showSidebar(html); //
  //.showModalDialog(html,"Anket Sonucu Görme Uygulaması Bilgi Girişi");
  //.showSidebar(html);
}

function appendData(Bilgi) {
  var ws = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Giriş");
  ws.getRange('B2').activate();
  ws.getCurrentCell().setValue(Bilgi.epostam);
  ws.getRange('B3').activate();
  ws.getCurrentCell().setValue(Bilgi.sifrem);
  Utilities.sleep(2 * 1000);
  SonucGor();
};

I'm a beginner in coding business. Sorry for my bad english. I'm looking for all your help. Thanks.

0 Answers0