从html5文件系统API加载资源 [英] Loading resources from html5 filesystem api

查看:134
本文介绍了从html5文件系统API加载资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个chrome扩展,动态地将一些html页面及其资源写入文件系统。我有大部分的工作,但我只是注意到,当我试图通过导航到文件系统打开其中一个页面:chrome-extension:// ... url通过 fileentry.getURL()方法获得,页面打开,但chrome不会获取任何相关的资源:样式表,图像等任何想法,为什么这可能是?有一些安全标志,我需要得到这个工作?我是这样做的全部错误?
$ b $(有一点可能是相关的,资源是由相关的url确定的,但是我知道它们是正确的文件,因为如果我手动解决它们,并浏览到我可以抓取它们的网址。)

相对URL不理解HTML5文件系统的映射。如果您更改URL以指向fileentry.getURL()调用给您的内容,那么这应该是有效的。



目前有一个错误,允许资源中的相对URL像你试图做的那样使用: http://crbug.com/89271


I am writing a chrome extension that dynamically writes some html pages and their resources to the file system. I have most things working but I just noticed that when I try to open one of the pages by navigating to the filesystem:chrome-extension://... url that I obtain via the fileentry.getURL() method, the page opens, but chrome does not fetch any of the associated resources: stylesheets, images etc. Any ideas why this might be? Are there some security flags I need to get this working? I am i going about this all wrong?

(One thing that may be relevant is that the resources are identified by relative urls. But I know they are correct relative to the file because if i manually resolve them and browse to the URLs I can fetch them.)

解决方案

The page you include that uses the relative URLs doesn't understand the HTML5 filesystem's mapping. If you change the URLs to point to what the fileentry.getURL() calls give you, then this should work.

There's currently a bug that allows relative URLs in resources to be used like you're trying to do: http://crbug.com/89271

这篇关于从html5文件系统API加载资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆