Search code examples
javascriptgoogle-chrome-extensiongoogle-chrome-devtoolsjavascript-injectionrequestly

Enter full screen automatically by inserting script in a webpage using requestly


I want to go into full-screen mode (F11) on certain pages. For this, I am using Requestly chrome extension to insert a script on a webpage.

Here is the script

document.body.requestFullscreen();

When I run this script directly in the console, I am able to go into full-screen mode. However, when Requestly is executing the script, the script is being executed but the full-screen mode is not triggered.

Even MDN Documentation of requestFullScreen doesn't provide any additional information about this.

Need to understand if there are technical limitations about this requestFullscreen() API that this has to be user-intent driven like click etc and cannot be automatically called?


Solution

  • TLDR; This is not possible to auto-trigger full-screen mode using Script Insertion. It has to be based on user Interaction.

    As per requestFullscreen MDN documentation

    This method must be called while responding to user interaction or a device orientation change; otherwise, it will fail.

    I tried triggering an automatic click on a button dynamically inserted into the page but we get the same error.

    enter image description here

    Here's the Insert Script Rule I created in Requestly

    enter image description here