Url Firefox和Chrome中的window.location为Google宏提供了两个不同的返回字符串

Url Firefox和Chrome中的window.location为Google宏提供了两个不同的返回字符串,url,browser,google-apps-script,Url,Browser,Google Apps Script,我的应用程序正在使用谷歌应用程序脚本HTML服务。应用程序的URL脚本如下所示: https://script.google.com/macros/s/AKfycby2Zr2apAai2sIW6eiWTc8yNakGg5M9oLQkmhcz-IRqs22qoJhm/exec 在Firefox中,这行代码: window.daURL = window.location; 返回以下内容: https://script.google.com/macros/blank Firefox将单词输入为

我的应用程序正在使用谷歌应用程序脚本HTML服务。应用程序的URL脚本如下所示:

https://script.google.com/macros/s/AKfycby2Zr2apAai2sIW6eiWTc8yNakGg5M9oLQkmhcz-IRqs22qoJhm/exec
在Firefox中,这行代码:

window.daURL = window.location;
返回以下内容:

 https://script.google.com/macros/blank
Firefox将单词
输入为空白
。Chrome为我提供了整个URL。 我一直在做的是,获取整个URL,然后使用Javascript字符串方法解析URL,以获取检查Facebook登录所需的任何信息。Facebook登录将信息附加到URL的末尾,以哈希标记开头。如果散列标签在那里,代码将检查并验证Facebook登录

我需要整个URL,或者能够在
/exec
之后获得附加字符串

Chrome为我提供了带有
窗口的整个URL。位置
,但Firefox不会

如果我尝试:

window.daURL = window.location.pathname; 
window.daURL = window.location.search;
Firefox返回:

/macros/blank
如果我尝试:

window.daURL = window.location.pathname; 
window.daURL = window.location.search;
我没有得到任何返回,即使在URL中附加了字符串

我可以通过应用程序脚本
doGet(e)
函数将字符串附加到URL:

e.parameter.theNameOfTheStringArg
例如www.URL.com?myArg=Something

用法:
var getString=e.parameter.myArg


但是我无法通过
doGet(e)
获得URL的哈希附加值。我需要检查URL中是否存在哈希。

我发现我可以使用
window.location.href
检查附加到URL的哈希标记是否存在。因此,我使用
window.onload
检查url中的标签,并使用
doGet(e)
检查url中的字符串附件。我两个都要跑

<script>
//Script tag in first HTML file that always loads

window.onload=function(){
  console.log("This onload did run");

  //get the URL out of the browsers address bar
  //the URL can have multiple different strings attached depending upon the situation.
  //Any situation other than something with a hashtag is initiated in the back end.

  window.daURLhash = window.location.hash;
  console.log('daURLhash: ' + daURLhash);

  window.urlHash = daURLhash.toString();
  console.log('urlHash: ' + urlHash);

  console.log("url: " + urlHash);
  //If a certain situation, there will be a hashtag in the url string
  if (urlHash != undefined && urlHash != null) {
    if (urlHash.length > 0) {
      window.hashExist = true;
      console.log('hashExist: ' + hashExist); 
    };
  };

  if (window.hashExist === true) {
     code here

</script>

//始终加载的第一个HTML文件中的脚本标记
window.onload=function(){
log(“此onload确实运行”);
//从浏览器地址栏中获取URL
//根据情况,URL可以附加多个不同的字符串。
//除了带有hashtag之外的任何情况都会在后端启动。
window.daURLhash=window.location.hash;
log('daURLhash:'+daURLhash);
window.urlHash=daURLhash.toString();
log('urlHash:'+urlHash);
log(“url:+urlHash”);
//如果在某种情况下,url字符串中将有一个标签
if(urlHash!=未定义&&urlHash!=null){
如果(urlHash.length>0){
window.hashExist=true;
log('hashExist:'+hashExist);
};
};
if(window.hashExist==true){
代码在这里

另外:当您使用sandbox=NATIVE时,我可以在客户端javascript中获取location.hash值。当sandbox=IFRAME时,我无法获取该值。doGet(e)无法访问哈希值,因为浏览器通常不会将其传递给服务器。请参阅