Google Chrome Socket API的扩展程序 [英] Google Chrome Socket API in extensions

查看:465
本文介绍了Google Chrome Socket API的扩展程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,在开发了几个小时的扩展之后,假设chrome.socket API可用于扩展,我加载了扩展,并且我被告知Socket API仅适用于'Packaged Apps'。



有人知道发生了什么,扩展是否会获得该功能(返回,因为我认为它们在.experimental中可以访问)?

解决方案

Chrome文档
$ b


打包应用程序可以充当TCP和UDP连接的网络客户端。


不,扩展程序无法访问套接字API,并且它们不太可能获得它。



您的困惑是可以理解的,因为谷歌称之为打包的应用程序曾经只是主屏幕上带有图标的荣耀扩展。但是,Google现在正在推动扩展和应用之间的更广泛的分工。

扩展曾经具有应用所做功能的子集,但是现在存在互斥功能每一个。扩展程序旨在增强正常的Web浏览,而应用程序旨在用作不影响正常浏览的独立工具。如果您查看应用程序的API列表和 extensions ,你会发现这个列表很不一样:应用程序具有强大的硬件,而且以操作系统为中心的API如 socket usb 蓝牙 ,而扩展则垄断以浏览器为中心的API,如选项卡 Cookie 书签


So after developing an extension for a few hours, assuming that the chrome.socket API would be available to extensions, I load in my extension and I'm told that the Socket API is only available for 'Packaged Apps'.

Does anyone know what's happening, and whether extensions will get the feature (back, since I think they had access when it was in .experimental)?

解决方案

From the Chrome docs:

Packaged apps can act as a network client for TCP and UDP connections.

No, extensions do not have access to the socket API, and they aren't likely to ever get it.

Your confusion is understandable, since what Google called "packaged apps" used to be nothing but glorified extensions with an icon on the home screen. However, Google is now driving a much wider divide between extensions and apps.

Extensions used to have a subset of the functionality the apps did, but now there is mutually exclusive functionality in each. Extensions are meant for enhancing normal Web browsing, whereas apps are meant to be used as stand-alone tools that do not interfere with normal browsing. If you look at the API lists for apps and for extensions, you'll see that the list is vastly different: apps have the powerful hardware- and OS-centric APIs like socket, usb, and bluetooth, while extensions have a monopoly on browser-centric APIs like tabs, cookies, and bookmarks.

这篇关于Google Chrome Socket API的扩展程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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