1

I was trying to achieve full screen on an element in Lightning Web Components but was unable to use Document.fullscreen API.

I tried var elem = this.template.querySelector('svg');

if (elem.requestFullscreen) {
    elem.requestFullscreen();
  } else if (elem.mozRequestFullScreen) { /* Firefox */
    elem.mozRequestFullScreen();
  } else if (elem.webkitRequestFullscreen) { /* Chrome, Safari and Opera */
    elem.webkitRequestFullscreen();
  } else if (elem.msRequestFullscreen) { /* IE/Edge */
    elem.msRequestFullscreen();
  }

But in LWC document component doesn't have particular functions and so was unable to implement full screen functionality.

Please help, I am quiet new in using Lightning Web Components(LWC)...

1 Answer 1

5

Locker is currently preventing access to the fullscreen API, not LWC. You can try out the following snippet of javascript in the Locker console.

document.body.requestFullscreen
// Locker OFF: function requestFullscreen() {[native code]}
// Locker ON: undefined

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .