javascript javascript可以获取当前WiFi连接的SSID吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17750175/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can javascript get the SSID of the current WiFi connection?
提问by Poodimizer
I need to get the SSID of the currently connected WiFi Network (if it is wifi). Is this possible?
我需要获取当前连接的 WiFi 网络的 SSID(如果是 wifi)。这可能吗?
I saw something on it here (http://www.w3.org/TR/system-info-api/#network), but I can't seem to get the code to run. Is there a library I need to import or is this just planned implementations?
我在这里看到了一些东西(http://www.w3.org/TR/system-info-api/#network),但我似乎无法运行代码。是否有我需要导入的库,或者这只是计划中的实现?
I'm writing a phonegap application and need to know whether I should connect to a server locally or if I need to go remotely.
我正在编写一个 phonegap 应用程序,需要知道我是应该在本地连接到服务器还是需要远程连接。
Thanks
谢谢
采纳答案by Poodimizer
It is not possible as of this time. However PhoneGap does let you build plug-ins that will accomplish this task.
目前是不可能的。但是,PhoneGap 确实允许您构建可完成此任务的插件。
There is currently one available from HondaDai under the MIT license located at https://github.com/HondaDai/PhoneGap-WifiInfoPlugin.
目前,HondaDai 在 MIT 许可下提供了一个位于https://github.com/HondaDai/PhoneGap-WifiInfoPlugin 的许可。
** and it works beautifully. After I figured out how it works. His example on how to get the SSID that shows wifi.SSID as a variable is incorrect. It is actually wifi.activity.SSID as there are two JSON objects in the return and I wanted to access the one title activity.
** 而且效果很好。在我弄清楚它是如何工作的之后。他关于如何获取将 wifi.SSID 显示为变量的 SSID 的示例不正确。它实际上是 wifi.activity.SSID,因为返回中有两个 JSON 对象,我想访问一个标题活动。
回答by makeroo
Poodimizer is right. If you need iOS support, I forked WifiWizard. See: https://github.com/makeroo/WifiWizard
Poodimizer 是对的。如果你需要 iOS 支持,我分叉了 WifiWizard。见:https: //github.com/makeroo/WifiWizard
Although only getCurrentSSID is supported due to Apple limitations.
尽管由于 Apple 的限制,仅支持 getCurrentSSID。