Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding module for getting battery status #987

Merged
merged 1 commit into from Mar 25, 2014
Merged

Conversation

@ecneladis
Copy link
Contributor

ecneladis commented Mar 24, 2014

No description provided.

bcoles added a commit that referenced this pull request Mar 25, 2014
Adding module for getting battery status
@bcoles bcoles merged commit dde007c into beefproject:master Mar 25, 2014
@bcoles bcoles added the Module label Mar 25, 2014
@bcoles bcoles self-assigned this Mar 25, 2014
@bcoles

This comment has been minimized.

Copy link
Collaborator

bcoles commented Mar 25, 2014

Merged. Thanks @ecneladis

I've confirmed this works on latest Firefox 28.

In my limited testing I noticed virtual machines and devices without a battery return battery.level=1, so it's possible to determine if the device has a battery with (battery.level != 1 and battery.level != 0) - despite the W3C spec:

The API defined in this specification is used to determine the battery status of the hosting device. The information disclosed has minimal impact on privacy or fingerprinting, and therefore is exposed without permission grants. For example, authors cannot directly know if there is a battery or not in the hosting device. http://www.w3.org/TR/battery-status/

@ecneladis

This comment has been minimized.

Copy link
Contributor Author

ecneladis commented Mar 25, 2014

Works also on Firefox 22.0 (Mozilla/5.0 (Windows NT 5.1; rv:22.0) Gecko/20100101 Firefox/22.0).

It depends on the VM software I guess. Virtualbox send proper power status to guest by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.