8

Does windows phone 8 fully support touch events within the default browser?

Does it work out of the box so that arbitrary touchmove events can be detected by a web-page?

I have had issues with some browsers which hijack the touchmove events to use for their interface as a swipe gesture. Does windows phone 8 browser do anything like that?

Can anyone point to any documentation about windows phone 8 touch events?

EDIT:

There is a page here that would allow someone with a wondows phone 8 to test the touch capabilities: http://blogs.msdn.com/b/ie/archive/2011/10/19/handling-multi-touch-and-mouse-input-in-all-browsers.aspx

I would greatly appreciate if someone could try it out and let me know if it works or not.

However, there are a couple of comments...

SnarkMaiden 20 Oct 2011 11:17 AM # Just for curiosity; I have a tablet PC with both pen and touch - in IE9, with the pen I can draw in the field but with my finger I can only scroll the page. Is that expected behaviour? Ted Johnson [MSFT] 20 Oct 2011 11:28 AM #

@SnarkMaiden: Unfortunately, yes, that's the expected behavior in IE9 and document mode 9 in IE10. IE9 has no way to override the default panning gesture. IE10's 10 mode has a new CSS property, "-ms-content-zooming: none" that disables panning and zooming on the target element. BTW, this blog runs in document mode 9 in IE10. So even IE10 users with touch are also seeing this behavior.

So still might not work form that page, even if it is possible on the device.

2 Answers 2

37

You should take a look at here: Updating touch and pointer events (official Windows Phone developer blog post).


EDIT: quote relevant parts of linked document

WebKit and Internet Explorer 10 handle touch event handling differently. WebKit supports a touch interface that is separate from mouse handling; IE10 groups touch, mouse, and stylus into a single interface (pointer). The pointer event model also has been submitted to the W3C for standardization under the Pointer Events Working Group. Although they are different, the models are generally similar, so support for pointer events can generally be added with minimal code changes.

Adding pointer event listeners

The pointer API uses a standard “down, move, up” event model. Therefore, it’s simple to hook up listeners for existing event handlers to pointer events.

Before

this.element.addEventListener("touchstart", eventHandlerName, false); 
this.element.addEventListener("touchmove", eventHandlerName, false);
this.element.addEventListener("touchend", eventHandlerName, false);

After

if (window.navigator.msPointerEnabled) {
  this.element.addEventListener("MSPointerDown", eventHandlerName, false);
  this.element.addEventListener("MSPointerMove", eventHandlerName, false);
  this.element.addEventListener("MSPointerUp", eventHandlerName, false);
}
this.element.addEventListener("touchstart", eventHandlerName, false);
this.element.addEventListener("touchmove", eventHandlerName, false);
this.element.addEventListener("touchend", eventHandlerName, false);

Turning off default touch behavior

The pointer event model in Internet Explorer 10 requires you to explicitly indicate which areas of the page will have custom gesture handling (using the code you just added), and which will use default gesture handling (pan the page). You can do this by adding markup on elements that should opt out of default gesture handling using the -ms-touch-action property. For example:

Before

<div id="slider" style="overflow: hidden;">

After

<div id="slider" style="overflow: hidden; -ms-touch-action: none;">

In addition to none, IE10 on Windows Phone 8 also supports the pan-x and pan-y properties, which specify that the browser should handle horizontal or vertical gestures, and custom JavaScript handlers should handle everything else.

2
  • Excellent - exactly what I needed. Both answers my question about touch events, and how to override browser gesture detection on elements. I will edit your answer to add the relevant parts for future viewers. Thanks a lot!
    – Billy Moon
    Nov 16, 2012 at 13:11
  • 4
    This will cause problems in IE11 on Windows Phone 8.1 as MSPointerDown becomes pointerdown (ect.) so the workaround needs to be a little bit more complex. Microsoft supports the unprefixed pointer API now (which is good in general but bad for backwards compatibility). May 9, 2014 at 9:06
2

It looks like this will be similar to IE 10 for Windows, with some exceptions...

From MSDN, "Web development for Windows Phone":

Unsupported features in Internet Explorer for Windows Phone OS 8.0: The following features are supported in the desktop version of Internet Explorer 10, but are not supported in Internet Explorer for Windows Phone OS 8.0.

...

CSS Touch views – specifically overview, scroll, and accelerated scrolling.

Rotation and angular events as related to gesture events.

UPDATE: The link in your update works in the IE 10 for the phone. Touch in the SVG canvas draws with multi-touch. (It doesn't scroll the page in this area but does on the rest of the page).

1
  • looks promising, but still not definitive. thanks for the link
    – Billy Moon
    Nov 15, 2012 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.