javascriptgoogle-chromehtml5-fullscreen

what constitues user gesture


I recently programmed a menu interface for javascript that lets you dynamically add options to it and mostly works with mouseEnter Events . I thne added some basic video Controls to it with request/exit Fullscreen that trigger on one of these mouseEnter events most of the time it displays Failed to execute 'requestFullscreen' on 'Element': API can only be initiated by a user gesture. however (weird part :) sometimes it works and im not sure how the browser api decides wether an action is a user gesture or not oO any help would be appreciated thanks


Solution

  • Here is the list of events that can trigger "by user activation" as defined by the specs:

    This is what your error message refers to when they say "a user gesture".

    mouseenter is not part of this list.

    Most likely, when it worked, it was because one of those event did happen less than a few ms before (IIRC it's 50ms in Chrome currently).