Is it possible to do mash-ups in FirefoxOS?

为君一笑 提交于 2020-01-24 15:27:32

问题


I have just started doing research, but I assume that other people might have the same question: Is it possible to read data from different sources for a FirefoxOS application, such as reading from RSS feeds from different domains?

Are you constrained by same-origin policy or is there a way to bypass it?


回答1:


Yes you can! If you create a standard web app, just build a web app like you normally would outside of Firefox OS. If you create a packaged app, include a request for the network-http permission in your web app manifest. This will give you unrestricted HTTP access.

See the manifest spec for more information on permissions:

network-http - Make HTTP requests without any origin restrictions.

https://developer.mozilla.org/en-US/docs/Apps/Manifest

Edit: The permission has since been changed to systemXHR.




回答2:


You can of course read data from external domains in a Firefox OS app just like you would in a website. You could read it with jsonp which is insecure or you could do it with CORS which is more secure. If you adhere to Content Security Policy (CSP) restrictions (this is the most secure) you will only be able to use secure methods like CORS.

There is nothing stopping you from making a Firefox OS app read external data like a website does. However, if you want to create a privileged packaged app then you must adhere to CSP.

(Sorry for the lack of links, Stack Overflow won't let me add more.)



来源:https://stackoverflow.com/questions/12730104/is-it-possible-to-do-mash-ups-in-firefoxos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!