Google Apps脚本HtmlService favicon在Safari中提供混合不安全内容警告

时间:2016-02-01 23:38:38

标签: https google-apps-script favicon

GAS HtmlService现在允许我们为我们的网络应用设置图标,如下所示:https://code.google.com/p/google-apps-script-issues/issues/detail?id=2005

然而,这只能在Chrome中完美运行。在Firefox和Safari中,我收到以下错误:Loading mixed (insecure) display content "http://www.google.com/url?q=<favicon url>" on a secure page

Safari拒绝显示图标,Firefox仍然显示它(不关心IE)。现在,我使用的favicon用“https”指定,可通过https访问(在imgur上托管)。

var html = HtmlService.createTemplateFromFile('page')
      .evaluate()
      .setSandboxMode(HtmlService.SandboxMode.IFRAME)
      .addMetaTag('viewport', 'width=device-width, initial-scale=1, maximum-scale=2.0, user-scalable=yes')
      //.setWidth(400)
      //.setHeight(300)
      .setTitle('...')
      .setFaviconUrl('https://i.imgur.com/<filename>');  

是否有人知道如何正确使用https加载图标以避免收到警告并在Safari中加载?

2 个答案:

答案 0 :(得分:1)

这看起来像个错误; it has been reported to the Google team

答案 1 :(得分:0)

这为我解决了chrome(例如):

function doGet() {

 return ShowPage();

}

function ShowPage() {

  var html = HtmlService.createHtmlOutputFromFile('Index')

      .setSandboxMode(HtmlService.SandboxMode.IFRAME)
      .addMetaTag('viewport', 'width=device-width, initial-scale=1, maximum-scale=2.0, user-scalable=yes')
      //.setWidth(400)
      //.setHeight(300)
      .setTitle('Banco de horas')
       html.setFaviconUrl('http://hkfew.org.hk/ckfinder/userfiles/images/20150126022444168.png')


  return html;

}