Hacker News new | comments | show | ask | jobs | submit login
Device Orientation in HTML5 (tilt your computer if you have a MacBook & Chrome) (html5rocks.com)
103 points by pud on Dec 18, 2011 | hide | past | web | favorite | 33 comments

The last three versions of Firefox have supported the W3C device orientation spec. Before that, and going all the way back to Firefox 3.5 more than two years ago, Firefox supported a vendor prefixed version.

Pity the developer didn't include -moz extensions, given the use of -webkit extensions you'd think he doesnt care about anything but Webkit.

Yeah, it's a couple years old now: http://news.ycombinator.com/item?id=1272481 At this point, much of the CSS3 demonstrated wouldn't require a vendor prefix at all.

Most of them are the same but with -moz instead of -webkit. Don't forget these are slides not blog posts. He had to pick one or risk too much info.

About 50% of the things on this page aren't HTML5, but chrome-only features.

Bleh for standardization, really.

If you are building something for wide market use then definitively don't use these new features until they are supported by multiple vendors. But before standardization can happen things have to be tried out, I don't see what all the negativity is about when it comes to new features in chrome (I don't get the same vibe with Firefox only features).

It's better, in my opinion, to have a working prototype of a feature working and used by some early adopters than to build standards in a vacum.

Those early adopters need to know those features my disappear or the apis change and be ready to fix their code.

The API they use was standardized, and supported by multiple browsers since long. The page is written to only work in WebKit browsers.

There is no need or sense in defending this behavior. It's bad, and shortsighted.

Or an IBM/Lenovo ThinkPad.

They all (ingeniously) use the sudden-drop detection that prevents hard drive head crashes to double as an accelerometer.

> They all (ingeniously) use the sudden-drop detection that prevents hard drive head crashes to double as an accelerometer.

I assume it's really the other way around—a "sudden-drop detector" is nothing more than an accelerometer.

Yes and no.

It's one of those things that are obvious in retrospect, but computers have had accelerometers used for sudden motion sensing for decades now, and most manufacturers employ this tech in some form or the other in their upper-end modules.

Yet it took one bright individual to figure out that there's no point in using the accelerometer just for SMS, when in fact, its API can be exposed to the world for whatever other accelerometer-related needs. I don't know why other manufacturers haven't followed suite, but given the state of the industry I would not be surprised if patents are, in one way or the other, to blame.

Many years ago, 2006, I was using the sudden-drop detection in my iBook G4 to know when people were walking down the hallway to my office.

Please provide more details on how you accomplished this, it sounds interesting.

Wouldn't you get false positives every time you typed?

Yes, but due to how the structure was (poorly? likely…) constructed, the movement caused by someone walking down the hall was much larger than me typing.

It took me a minute to figure out how the site achieved its sorcery, but then was reminded of the Sudden Motion Sensor.

For the curious: http://en.wikipedia.org/wiki/Sudden_Motion_Sensor

My friend has one but running Ubuntu and it doesn't work.

Is this exclusive to Windows/OSX?

The hardware is there, I guess Ubuntu just doesn't have the drivers for this chip or your friend doesn't have them installed.

In theory, this is cross-platform.

it would be cool if GMail and other data sensitive web applications used these APIs so that it would log you out of the web service if your computer had a lot of motion (e.g. someone running away with it).

Interesting idea but it would make gmail impossible to use on a train or bus.

All motion is not equal. You could probably build some sort train and bus motion profile and compare against that.

true :D

correct, back to the drawing board! :)

wrote a labyrinth demo back in the day to demo the Firefox-prefixed version of the API. I've updated it here: http://potch.me/labyrinth/

doesn't seem to work on my 2011 air

Nor mine, I suspect its because the accelerometer is designed to halt the disk if it detects sudden movement. There is no hard disk in the airs thus it has no need for an accelerometer.

I'm guessing they left out the motion detector, since the air is fitted with an SSD, and there's no hard drive that needs protection.

Unfortunately it doesn't work with Airs, since they don't have an accelerometer. I believe the only reason MBPs have them is so they can lock up the hard drive if a computer is dropped.

I'm still waiting for someone to build a popular whack based interface based on this data. I'd love a photo album where I would tap the side of my screen to advance to the next/previous photo.

The hdaps Linux kernel driver for Thinkpads' sensors (don't know about the other flavors) can export the data as a joydev, which can be mapped arbitrarily - I've tried things like desktop switching by hard taps to either side of the keyboard, but it's more of a neat gimmick than a useful interaction mode. Some (severely out of date) scripts here: http://www.thinkwiki.org/wiki/HDAPS (no HTML in comments?)

It seems to only react to two axes (beta and gamma -- in other words, if I rotate my MBP on a flat surface, nothing happens) -- is anyone on a device that provides alpha as well? I know the iPhone does, but this demo doesn't seem to work in Mobile Safari.

Doesn't that require a gyroscope? Most devices that would work with this only have accelerometers.

No JS required w/CSS media query, e.g. @media only screen and (orientation: landscape) {...}

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact