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) {
  } else if (elem.mozRequestFullScreen) { /* Firefox */
  } else if (elem.webkitRequestFullscreen) { /* Chrome, Safari and Opera */
  } else if (elem.msRequestFullscreen) { /* IE/Edge */

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)...


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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.