Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Require user gesture for navigator.vibrate in cross-origin iframes #25

Closed

Description

@lubin2010

Vibrate is being abused by unsafe third-party content (eg., malicious ads), and some users have complained about it (e.g., this reddit thread). To better protect user, we would like to block vibrate if it is called in cross-origin iframes (eg., a lot of ads are rendered inside cross-origin iframes). The measurement from Chrome shows that vibrate from (same-origin+cross-origin) iframes is being used by ~0.00025% of pages (the metrics link), and so it is considered a low risk removal.

Meanwhile, if really needed, we could provide a permission API to reenable it, since the permissions/feature-policy work is moving forward.

Activity

  1. changed the title [-]Remove navigator.vibrate in cross-origin iframes[/-] [+]Block navigator.vibrate in cross-origin iframes[/+] on Jul 1, 2016
  2. changed the title [-]Block navigator.vibrate in cross-origin iframes[/-] [+]Remove navigator.vibrate in cross-origin iframes[/+] on Jul 1, 2016
  3. changed the title [-]Remove navigator.vibrate in cross-origin iframes[/-] [+]Block navigator.vibrate in cross-origin iframes[/+] on Jul 5, 2016
  4. lubin2010 commented on Jan 18, 2017

    @lubin2010
    Author

    An update: For now, the vibrate function could be turned on by the web site owners (See https://bugs.chromium.org/p/chromium/issues/detail?id=623682):
    For example, if you have an iframe (src=B.com) that you'd like to enable vibrate for it, you will have to include a header: "Feature-Policy: {"vibrate": [B.com]}". Alternatively you can enable vibrate for all iframes by "Feature-Policy: {"vibrate": [*]}" or all same-origin iframes by "Feature-Policy: {"vibrate": [self]}". If you want to disable it, you can do "Feature-Policy: {"vibrate": []}".
    By default vibrate is enabled for self, which means current frame and same-origin iframes have permission to vibrate.

    Also we are working on implementing iframe attribute for feature policy (please see https://github.com/WICG/feature-policy/ and crbug.com/682258), and you might be able to enable vibrate for any iframe in future by something like: <iframe src=... enable="vibrate"></iframe>.

  5. VicenteDiaz commented on Jan 19, 2017

    @VicenteDiaz

    Hi @lubin2010,
    As I mentioned in my private emails, our company has created a haptic video advertising content, called Haptter, to improve user experience in advertising, and I consider that this Vibrating API behavior modification, by blocking cross-domain iframe affect our haptic video solution and are causing problems in our running advertising campaigns in Spain. Obviously it will affect future haptic reach media content advertising. You can read the results of the impressive user experience using haptic video advertising in USA to promote HomeLand here: https://www.thinkwithgoogle.com/campaigns/homeland-trailer.html so it has been demonstrated that these kind of content is preferred by users over conventional videos.

    I consider that maybe a year ago malicious vibration was a big issue but today programmatic advertising tools and ecosystem allow avoiding this kind of content to be displayed in publishers easily, making this modification no sense pretty soon.

    Nevertheless, if you are still interested in blocking it, in order to allow our format and future advertising formats using vibration (like embedded games advertising) in current publishers I propose a "vibrate" by default "Feature-Policy" This way when publisher consider that this kind of advertising is arriving to its website and it is annoying their users, it can block/disable temporarily or in a definite way by adding "Feature-Policy:{"vibrate":[]}" as you propose. If you do the way you are proposing now, millions of websites should be modified to allow this kind of creativities to work, causing a big damage to the evolution of engaging creativities.

    As I told above, this kind of malicious vibration will disappear as soon as Sell Side Platforms and Demand Side Platforms detect it. Consider also that such malicious vibration ads have to pay the publisher to be published so there will be two cases:

    1. Publisher don't like such traffic in its site: so it can talk to the DSP/adserver where it comes to ask it to block the origin of this malicious ads. This is a typical "whitelist/blacklist" procedure used today.
    2. Malicious ads must compete in the RTB ecosystem with high quality creativities that bid for much more money than the malicious ads so being not profitable for such malicious ads as they have to pay much money to be published without any result for them: no clicks, engagement or interaction (People doesn't like it).

    That's the way on my opinion.
    Best
    Vicente

  6. RByers commented on Jan 19, 2017

    @RByers
    Member

    There's some reports of potentially legitimate future use cases being broken by this. For example, maybe it's possible that users want to interact with an interactive ad which can be more engaging with vibration without the publisher / ad network needing to opt-in specifically. Less controversially, an embedded map may want to provide haptic feedback when the user is interacting with it. Is it really worth the cost to require the embedder in such a case to opt-in specifically? For existing deployments explicit opt-in to enable a new feature like haptic feedback may be very difficult in practice.

    The primary benefit of this intervention is for the case where the user has not (and will not) explicitly interact with the iframe at all. In those cases I feel we should continue to block vibration.

    What exactly is it that Firefox is doing here, they've got some sort of enabling mechanism, right? Can we find the engineers involved and ask for their input?

    How about relaxing this restriction so that vibration can succeed after the frame has processed SOME task that was triggered by user activation? I.e. after the user taps (but not just because they scrolled) the iframe becomes active.

  7. lubin2010 commented on Jan 19, 2017

    @lubin2010
    Author

    @bzbarsky (from Mozilla), Do you know what Firefox is doing for vibrate on mobile devices? Thanks.

  8. VicenteDiaz commented on Jan 19, 2017

    @VicenteDiaz

    Thanks @RByers for your comments.
    In fact one of my surprises was that Firefox pops up a selection (YES/NO) to allow vibration. It is not the best way but it works.

    In my opinion we should do something like this:

    1. When a cross-domain iframe using vibration appears, browser doesn't allow vibration until user press an icon or message in the middle of the iframe indicating it vibrates. Message disappears in about 3 sec.
    2. If users don't interact with the iframe by clicking on it, the iframe doesn't vibrate. It's just like autoplay videos are played without sound.

    Notes: Instead of adding a message that disappears in 3 sec. we can add a vibration activated icon on top-left corner in iframe so when user press it, it vibrates, by pressing again it stop vibration and so and forth. Position is chosen because usually sound activation is located in the lower-right corner.

    Another option could be to disallow vibration by default and force advertisers to add a button/control to allow when user activate it. This way no advertising will work if iframe doesn't integrate such click button.

    Those are ideas but maybe they can work as a starting point.

  9. bzbarsky commented on Jan 19, 2017

    @bzbarsky

    @lubin2010 I don't, sorry. It's changed a few times too....

  10. RByers commented on Jan 19, 2017

    @RByers
    Member

    @VicenteDiaz sorry our original messages overlapped (didn't see yours come in before I posted mine).

    It sounds like your proposal is a strict subset of mine, right? I.e. in my proposal an ad could determine that vibration is disabled (@lubin2010 is this already feature-detectable?) and show its own "tap here to enable awesome haptic feedback" button. Once the user has tapped anywhere inside the iframe, vibration will be enabled for the lifetime of the frame. So rather than the browser defining the precise UI, the ad (or ad network) has control over that - as long as the user action includes a tap. Doesn't that work even better for you than what you proposed?

    By the way, for the record for others following along here is the blink intent-to-ship thread where we approved making this breaking change to Chrome.

  11. VicenteDiaz commented on Jan 19, 2017

    @VicenteDiaz

    Yes @RByers You are right (I didn't realized about your previous message, sorry).

    That's the best option for everyone! It simplifies everything and it avoids malicious content to vibrate, giving the advertiser the control over the message to be used to advert the user about haptic content.

    Thanks!
    P.D. I like your warning message example very much! Let's do it ;-)

  12. RByers commented on Jan 19, 2017

    @RByers
    Member

    @VicenteDiaz great, glad to hear you like this. Thinking about this more I think it's exactly analogous to our position on autoplay video and audio (#23). We don't allow audio by default in a cross-origin frame, but once the user taps a play button or something we do. It's conceptually identical IMHO except that we didn't have the examples of legitimate vibration cases in hand to force us to come to such a compromise from the start.

    @lubin2010 what's your thoughts on implementing this relaxation? Does it seem reasonable to you?

    @bzbarsky can you suggest how we can find out what was done in Gecko and who to talk to for more
    context? I've spent the last 20 minutes looking through bugzilla at all bugs with "vibrate" in the title and can't seem to find any discussion of this change.

  13. 17 remaining items

  14. RByers commented on Jan 23, 2017

    @RByers
    Member

    Do you mean that Chrome Canary ....

    I think we're getting a bit too far into Chrome implementation / release details for this cross-browser web-standards design forum. I've posted answers to your questions over on the relevant chromium bug, mind following up there? Sorry to be moving your around 😃

  15. VicenteDiaz commented on Jan 23, 2017

    @VicenteDiaz

    Yes, I'm a bit confused right now 🙃. But, nevertheless, now I understand what those Chrome Canary 🐤 changes are for. Thanks. When is ready we will test it asap. Have a nice week you all.

  16. RByers commented on Jan 25, 2017

    @RByers
    Member

    The above fix is in Chrome Canary - version 58.0.2992.0 and should be in the next Chrome 57 release. Here's a simple test page - it should only vibrate after it's tapped.

  17. VicenteDiaz commented on Jan 26, 2017

    @VicenteDiaz

    Thanks @RByers. We have been testing your test page and it works as you mentioned.
    We have started to test our previous samples and clients and they work fine with Canary.
    I think it is a nice and simple solution to allow us continue working when V.57 is available and also avoid malicious ads to vibrate when user does nothing.

    Here is a page by Sizmek to provide a demo of Haptter technology applied to a Lexus advertisement that now... works again with Canary version:

    http://testme.sizmek.es/mobile.php?id=0UKNGG
    sizmekhapttertest

    Based on my short experience, this kind of malicious "warning message" ads vibrate just when they appear (pop-up) to create attention so using this user gesture procedure no one will receive vibration on these kind of ads.

    By the way, just to have real figures, do you have figures on how long does it take to update Chrome version on, let's say >70%% of users, since release is available in Google Play? Is there any difference depending on geographical areas? It is because even though release is in march I need to know the deployment time to get back to our clients.

    In the mean time I will test beta versions as soon as they are available to detect any issue.
    Thanks to all of you for your effort and I hope soon V.57 will be available, the sooner the better ;-)
    Best regards

  18. VicenteDiaz commented on Jan 26, 2017

    @VicenteDiaz

    Relating to @RByers comment (6 days ago) about user vibration muting control:

    It's a good point that we need to think this through - my analogy isn't perfect. Audio has the fallback of the user muting their device if they're annoyed, but there's no tab or system-wide "mute vibrations"

    We have realized that if user deactivate vibration intensity for Vibration Notifications (not for feedback), Haptter videos does not vibrate, so it is a way to avoid any page to vibrate, a kind of muting vibration.

    By the way, I don't know why Vibration Notifications and not Vibration Feedback intensity is connected to Vibration API. In our case it is more natural that Haptic vibration (feedback) should be connected to vibration.API instead, or even not connected at all with any OS setting, but this an OS related issue not for this discussion.

    Hope this comment helps you.
    Regards

  19. added this to the milestone on Feb 21, 2017
  20. removed this from the milestone on Feb 21, 2017
  21. changed the title [-]Block navigator.vibrate in cross-origin iframes[/-] [+]Require user gesture for navigator.vibrate in cross-origin iframes[/+] on Mar 2, 2017
  22. Xalaxis commented on Apr 30, 2018

    @Xalaxis

    As this is shipped, I believe this issue should be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions