Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
399 views
in Technique[技术] by (71.8m points)

javascript - Fullscreen from a bookmarklet in firefox doesn't work, how to workaround

Firefox prevents running fullscreen code for security reasons (i guess, to prevent social engineering and fraudulent windows).

This is thoroughly discussed in SO, here.

What is not mentioned there, is going fullscreen from bookmarklets.

javascript:(function(){document.documentElement.requestFullscreen();})();

The above works on Chromium; FF blocks it: "Request for fullscreen was denied because Element.requestFullscreen() was not called from inside a short running user-generated event handler."

But the bookmarklet IS triggered by a click. Is it a bug or intentional?

What I tried:

  • running the fullscreen command in under 1 second;
  • running the command from the console.
  • searching SO :)
question from:https://stackoverflow.com/questions/65930329/fullscreen-from-a-bookmarklet-in-firefox-doesnt-work-how-to-workaround

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...