1

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?

Sachin Jain
  • 21,353
  • 33
  • 103
  • 168
  • in sometime we need some click listener for triggering script or you can write it on javacript onready or onload function. – Muthulakshmi M Feb 03 '22 at 02:29
  • I believe that's one of those things that require the user to interact with the page first. Try executing in on a button click. – 001 Feb 03 '22 at 02:29
  • 2
    "This method must be called while responding to a user interaction or a device orientation change; otherwise it will fail." [Read more..](https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullScreen) – amlxv Feb 03 '22 at 02:48

1 Answers1

1

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

Sachin Jain
  • 21,353
  • 33
  • 103
  • 168