issue with element.requestFullscreen() function in Version 18.2 of Electron

I have a VueJS2 app running inside Electron 18.2 and I'm trying to implement a feature where a specific div goes full screen when a button is clicked.

Below is the code snippet I am using for this functionality:

 console.log("fullscreenEnabled", document.fullscreenEnabled)
  if (!document.fullscreenElement) {
    if (this.$refs["container"].requestFullscreen) {
      this.$refs["container"]
        .requestFullscreen()
        .then(() => console.log("fullscreen works"))
        .catch(e => console.log("toggleFullscreen error", e))
    }
  } else {
    console.log("exit")
    if (document.exitFullscreen) {
      document.exitFullscreen()
    }
  }

The element with ref attribute of "container" is the one that should go full screen, and it's confirmed that document.fullscreenEnabled returns true.

When testing this code on a fresh Electron project of the same version, it works perfectly fine without any issues. However, in my current project, no output is shown in the console and the div does not expand to full screen upon clicking the button assigned with @click="toggleFullScreen"

I am wondering if there could be some Electron settings that are preventing the fullscreen API from functioning properly in this specific project. Since I did not create the project myself but only need to add this function, I am uncertain about the configurations that may be affecting it.

The project utilizes VueJS2, Nuxt2, Electron 18.2, and Vuetify framework.

Your insights and suggestions would be greatly appreciated. Thank you.

Answer №1

After investigating, I have identified the issue. It appears that I forgot to grant permissions for fullscreen in the main file once the application has finished loading

session.defaultSession.setPermissionRequestHandler(
        (webContents, permission, callback, details) => {
            if (permission === "fullscreen") {
                callback(true);
            }
        }
    );

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Easily send maps and directions straight to your mobile device with mapQuest

Currently creating a web application with mapQuest integration. I have two queries: 1) Is there a way to share routes from the web app to my phone? 2) How can I track my phone device and display the route on the web app? Appreciate any assistance. PS: Us ...

Understanding and aggregating data from JSON files

I am in possession of a group of json values outlined below {"labels":[ "time", "softirq", "user", "system", "nice", "iowait" ], "data":[ [ 1490088352, 0, 14.64646, 3.53535, 0, 1.0101 ], [ 1490088351, 0, 27.77778, 3.0303, 0, 0 ], [ 1490088350, 0.49751, 12 ...

The Rtk query function does not generate endpoints

Having trouble with code splitting in RTK-query, it's not working for me and I can't figure out why App.jsx import React from "react"; import { Provider } from "react-redux"; import store, { persistor } from "store" ...

The initial element within the div style is malfunctioning

Could someone assist me in understanding why the first-of-type CSS is not working correctly? .item:first-of-type .delete{ display: none ; } .delete { text-decoration: none; color: red; padding-top: 40px;} .add_form_field { white-space: nowrap; } < ...

What methods are available to fill a canvas with shapes other than circles?

My goal is to fill the canvas with a black color. The code I have used for this purpose is as follows: var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); ctx.fillStyle='rgba(0,0,0,0.1)'; ctx.fillRect(0,0,c.width,c.height) ...

Tips on maintaining expanded rows in a table within Element UI

My table from element-ui is draggable: <table-card> <el-table-draggable @drop="changeDossiertypesOrder" handle=".handler"> <el-table :data="dossiertypes" v-loading="dossie ...

You cannot modify a variable inside an event handler function unless it is declared globally in the code

I am facing an issue with my nodejs backend app that uses mongoose for database connections and queries within an event handler of socket.io. Specifically, the problem arises when I try to update a variable within a callback function of a mongoose query in ...

The element div is not permitted as a child of the element h5 in this particular scenario

My code snippet is as follows: $compile .= "<h5 data-count='".$acctemmpi. "' class='shortcode_accordion_item_title expanded_". $expanded_state . "'>" . $title . "<div class='ico'&g ...

Nginx proxy pass interferes with the execution of Javascript within script tags

I currently have a website built with Nuxtjs that is functioning behind an nginx proxy_pass configuration. For instance, the Nuxtjs site can be accessed at , while the main site is located at http://example.com. Below is the nginx configuration for exampl ...

Retrieving ng-pattern as a variable from a service

Hey there! I'm currently working on an application that requires extensive form validation across multiple pages. To streamline this process, I am attempting to extract validation patterns from a service used among the controllers. However, I've ...

Error encountered: Scrollanimation IOS syntax error- Unexpected token '=.' an open parenthesis '(' was expected before a method's parameter list

Encountering an issue with the scroll animation on older IOS devices (2019 and older) - I receive the following error message: SyntaxError: Unexpected token '='. Expected an opening '(' before a method's parameter list. class Event ...

How to properly load components in React?

I've been diving into building a simple app in React using ES6 and Babel. While working on it, I encountered an issue. I decided to incorporate the react-notifications package from https://github.com/minhtranite/react-notifications Following the docu ...

What is the function of async in Next.js when triggered by an onClick

Need help with calling an async function pushData() from a button onClick event async function pushData() { alert("wee"); console.log("pushing data"); try { await query(` //SQL CODE `); console.log("Done&quo ...

Struggling with the functionality of having numerous jQuery UI controls on a single page. Implementing the accordion control in multiple sections

For my current project, I am utilizing the jQuery UI accordion control twice on a single page. The first one functions perfectly fine, but when I attempt to add a second accordion, the original one stops working while the new one works correctly. Does any ...

the present time plus a one-hour situation

I am facing a challenge where I need to dynamically adjust the path based on specific time conditions. In this situation, I will be working with two date variables retrieved from an API: CheckInStartDate and CheckInEndDate. The current system date and tim ...

Facing Issues with Jquery ajax - No 'Access-Control-Allow-Origin'

<html> <head> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script> $( document ).ready(function() { $('#my-form') .submit( ...

Troubleshooting the Confirm Form Resubmission problem on my website

Hello everyone! I'm working on a website and facing an issue where refreshing the page triggers a confirm form resubmission prompt. Could someone please advise me on how to resolve this? Thank you in advance! ...

Slowdown in functionality

My current project involves creating a user interface for an Oven configuration application using CSS, Java Script, Jquery & Json. While the interface performs actions within milliseconds on browsers and simulators, my client has noticed that it takes seco ...

What are the steps to align my PSQL database with my Prisma migration without having to reset the entire database?

After creating a schema model named Appointment with various fields and roles, I decided to make changes by adding the "status" field directly to the Appointment table using the psql query tool. Subsequently, I updated the schema model to include the new ...

Collaborate and reuse Typescript code across various Node projects

Imagine we have a project structured like this: webapps ProjectA SomeClass.ts Package.json ProjectB SomeClass.ts Package.json Common LoggingClass.ts Package.json The Common "LoggingClass" needs to import a module from NPM. Let's say that ...