Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/423.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 服务工作者获取事件不是由Google API请求触发的_Javascript_Google Api_Service Worker_Progressive Web Apps - Fatal编程技术网

Javascript 服务工作者获取事件不是由Google API请求触发的

Javascript 服务工作者获取事件不是由Google API请求触发的,javascript,google-api,service-worker,progressive-web-apps,Javascript,Google Api,Service Worker,Progressive Web Apps,我发现我对谷歌API的请求不会触发服务工作者获取事件。获取静态资源和其他API会按预期触发事件 演示: 演示代码: 我还没有找到任何文件表明这是设计的 有人能解释为什么GoogleAPI请求不会触发fetch事件吗?这可能与oAuth有关吗?您可以检查您的DOM,并注意到Google的oAuth库在您的页面中注入了几个不可见的,如下所示: <iframe name="oauth2relay368346125" id="oauth2relay368346125" src="https:

我发现我对谷歌API的请求不会触发服务工作者获取事件。获取静态资源和其他API会按预期触发事件

演示:

演示代码:

我还没有找到任何文件表明这是设计的


有人能解释为什么GoogleAPI请求不会触发fetch事件吗?这可能与oAuth有关吗?

您可以检查您的DOM,并注意到Google的oAuth库在您的页面中注入了几个不可见的
,如下所示:

<iframe name="oauth2relay368346125" id="oauth2relay368346125" 
  src="https://accounts.google.com/o/oauth2/postmessageRelay?parent=https%3A%2F%2Flaurieboyes.github.io&amp;...&amp;forcesecure=1"
  tabindex="-1" aria-hidden="true" 
  style="width: 1px; height: 1px; position: absolute; top: -100px;">
</iframe>

这些
用于与Google API的所有网络通信。请注意,
s源于origin,因此这些调用是在您的服务人员范围之外进行的(仅在范围内工作)


出于安全原因,您的服务人员无法拦截该通信。

您可以检查您的DOM,并注意到Google的OAuth库将几个不可见的
注入到您的页面中,如下所示:

<iframe name="oauth2relay368346125" id="oauth2relay368346125" 
  src="https://accounts.google.com/o/oauth2/postmessageRelay?parent=https%3A%2F%2Flaurieboyes.github.io&amp;...&amp;forcesecure=1"
  tabindex="-1" aria-hidden="true" 
  style="width: 1px; height: 1px; position: absolute; top: -100px;">
</iframe>

这些
用于与Google API的所有网络通信。请注意,
s源于origin,因此这些调用是在您的服务人员范围之外进行的(仅在范围内工作)

出于安全原因,您的服务人员无法拦截该通信