服务工作者从iframe便笺中获取的任何调用-CK编辑器

服务工作者从iframe便笺中获取的任何调用-CK编辑器,iframe,service-worker,progressive-web-apps,ckeditor4.x,Iframe,Service Worker,Progressive Web Apps,Ckeditor4.x,要使应用程序脱机,在我的应用程序中,在iframe上有一个src为空的,在iframe中有几个css文件。这些GET-to-GET-CSS没有命中服务工作者的fetch调用 主要是我在使用CK编辑器时遇到了这个问题,他们有 实现了iframe和所有插件CSS在内部呈现 这些CSS未缓存在缓存API中的Iframe。因此,当脱机时,CK编辑器无法正常工作 在读了几遍之后,这是因为服务人员的范围问题,我几乎没有尝试过这样做的方法。找到下面的代码 <iframe id="sampleIfram

要使应用程序脱机,在我的应用程序中,在iframe上有一个src为空的,在iframe中有几个css文件。这些GET-to-GET-CSS没有命中服务工作者的fetch调用

主要是我在使用CK编辑器时遇到了这个问题,他们有 实现了iframe和所有插件CSS在内部呈现 这些CSS未缓存在缓存API中的Iframe。因此,当脱机时,CK编辑器无法正常工作

在读了几遍之后,这是因为服务人员的范围问题,我几乎没有尝试过这样做的方法。找到下面的代码

 <iframe id="sampleIframe" src="./iframe" style="width:300px;height:400px;float: left;"> </iframe>

页面加载

var link= '<link href="./sample.css" rel="stylesheet" /><h1>Hi</h1>'; 
        var ifrm = document.getElementById('sampleIframe');
        ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument;
        ifrm.document.open();
        ifrm.document.write(link);
        ifrm.document.close();
var-link='Hi';
var ifrm=document.getElementById('sampleIframe');
ifrm=(ifrm.contentWindow)?ifrm.contentWindow:(ifrm.contentDocument.document)?ifrm.contentDocument.document:ifrm.contentDocument;
ifrm.document.open();
ifrm.document.write(链接);
ifrm.document.close();
一切正常,但CSS没有缓存到缓存API中。 **这是伪代码。
文档。open()
创建一个“about:blank”文档。该规范要求继承父文档的控制器,但目前chrome未实现此功能。见:

文档.open()创建一个“关于:空白”文档。该规范要求继承父文档的控制器,但目前chrome未实现此功能。见:


是否有任何方法可以使Iframe中的父服务工作人员的范围也变大。有黑客吗?我真的被困在这里了,而不是document.open()/write()。您可以使用document.createElement()创建链接,然后将其插入框架的主体中。是否有任何方法可以将父服务工作者的作用域也放入Iframe中。有黑客吗?我真的卡在这里了,而不是document.open()/write()。您可以使用document.createElement()创建链接,然后将其插入框架的主体中。