How to enter Full-Screen Mode with JavaScript - Fullscreen API Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 ม.ค. 2025

ความคิดเห็น • 84

  • @ahora1026
    @ahora1026 4 ปีที่แล้ว +4

    he is gonna make the rarest videos always. XD. love him

  • @ahmedbelloula9268
    @ahmedbelloula9268 2 ปีที่แล้ว +1

    i used it with reactjs it works perfectly, thank you for keeping it so simple

    • @ahmedbelloula9268
      @ahmedbelloula9268 ปีที่แล้ว

      @Pooja Bhandari banaula
      function TopNavbar({openSidebar}) {

      // use Fullscren Api to make the app full screen
      const fullScreen = () => {
      if (!document.fullscreenElement) {
      document.documentElement.requestFullscreen();
      } else {
      if (document.exitFullscreen) {
      document.exitFullscreen();
      }
      }
      };
      return (


      );
      }

  • @abusayed2773
    @abusayed2773 3 ปีที่แล้ว +2

    Easiest explanation !! keep going .

  • @AhmedMeklad
    @AhmedMeklad 3 ปีที่แล้ว +1

    i like this method because its work with vuejs without problems at all ... thanks man

  • @WIBEDRILLMusic
    @WIBEDRILLMusic 2 ปีที่แล้ว +1

    Was helpful for my react app. I did the same in the public/index.html. Thanks for always helping me out.

  • @patertyuiop
    @patertyuiop 4 ปีที่แล้ว +4

    Thanks for this tutorial!

  • @weirdbradleycomedy
    @weirdbradleycomedy 6 หลายเดือนก่อน

    Very informative!! Totally using this for now on :)

  • @PracticalFinancePro
    @PracticalFinancePro 4 ปีที่แล้ว +1

    Thanks dude. You are a saviour

  • @guysela3442
    @guysela3442 4 ปีที่แล้ว +2

    Very good tutorial. Thanks :)

  • @mithilanavishka4531
    @mithilanavishka4531 3 ปีที่แล้ว +1

    Hi I have struggled in One point Of Full screen, Can we call a function when click default close button of full screen mode, can You tell me, how could I catch that event?
    I want to Hide Expand button and show Collapse button when come to Full Screen Mode --> 1
    and I want to hide Collapse button and show Expand Button When come to normal screen --> 2
    Problem is 2 , I can't understand where I need to write that function
    Please Advise me.
    Thanks In Advanced.

  • @RudiLouw
    @RudiLouw 4 ปีที่แล้ว +4

    Thanks for a great tutorial. I have a difficult question - How do I get this to work on an iPhone mobile device. It works on iPad and desktop, but does not work in my iPhone XR? Would be fab if you had a solution as I need elements of my site to fire up in full screen on all devices.

    • @dcode-software
      @dcode-software  4 ปีที่แล้ว +1

      Hey mate, no problem. Sorry but I can't answer your question about the iPhone. Maybe iPhone doesn't support it or mobile devices in general don't want to support full screen mode

    • @RudiLouw
      @RudiLouw 4 ปีที่แล้ว

      @@dcode-software No worries, thanks anyway.

    • @ayushgupta137
      @ayushgupta137 ปีที่แล้ว

      Same problem I am facing this solution is not working for iphone

  • @wilbertgo8121
    @wilbertgo8121 3 ปีที่แล้ว +2

    Hi there.. is there anyway to get the webpage fullscreen on load?

    • @kamals6705
      @kamals6705 7 หลายเดือนก่อน

      did you find someway to do it?

  • @igorbondarenko9854
    @igorbondarenko9854 3 ปีที่แล้ว +2

    Thanks for the tutorial. Do you know what a situation in the safari browser? Does it support the full screen api?

  • @noxdacker
    @noxdacker 3 ปีที่แล้ว +1

    thank you very much!!!!!!! it works!!!! how could i force "landscape view" for mobile browsers?

  • @ravilpatel
    @ravilpatel 4 ปีที่แล้ว +2

    How can I hide this myBox id untill the user comes to full screen mode and hide if the user goes off the full screen? Thanks for the video....you are unique amongst all!!!

  • @tomekipro1687
    @tomekipro1687 2 ปีที่แล้ว

    I have question: is there some way to skip user action to working proper (I try "window.onload" but not working, something do, but not fullscreen)

  • @ridhwaans
    @ridhwaans 4 ปีที่แล้ว +1

    I am getting the error Failed to execute 'requestFullscreen' on 'Element': API can only be initiated by a user gesture.
    How do you get past that?

    • @veo2378
      @veo2378 4 ปีที่แล้ว

      u have answer at the begining of the video ;p

  • @youtischia
    @youtischia 3 ปีที่แล้ว +1

    Nice video. Any chance of video on how kiosk mode is different from fullscreen mode ? They are not the same.

    • @aubisoka
      @aubisoka 2 ปีที่แล้ว

      ? It is kiosk Mode when its fullscreen, isnt it?

    • @youtischia
      @youtischia 2 ปีที่แล้ว

      @@aubisoka NO they are not. Fullscreen mode and kiosk mode are not the same thing in JavaScript.
      Fullscreen mode is typically used to enhance the user's viewing experience by removing the browser's interface elements and displaying the webpage in a larger view. Kiosk mode typically locks down the device and limits the user's ability to access certain features or applications on the device, in order to prevent unauthorized changes or misuse.

  • @jcdeaton42
    @jcdeaton42 2 ปีที่แล้ว

    Thanks for the tip

  • @benimampunina696
    @benimampunina696 ปีที่แล้ว

    I use it with angular it works correctly, Thamks

  • @shulavkarki4253
    @shulavkarki4253 4 ปีที่แล้ว +1

    how to include for specific time?.
    .....like full screen mode for fix time?
    It would be very helpful.
    Thankyou

    • @HsbdbHdjnd
      @HsbdbHdjnd 8 หลายเดือนก่อน

      you got it ?

  • @Mayanksingh-qp6dy
    @Mayanksingh-qp6dy 4 ปีที่แล้ว +1

    How to toggle only a particular div?

  • @RadiantX917
    @RadiantX917 2 ปีที่แล้ว +1

    I want to go full screen automatically on page load. Please help

  • @pragyaprashantkumar5311
    @pragyaprashantkumar5311 4 ปีที่แล้ว +1

    Can u plzz help me with
    how can I disable escape button and use a "close window" button to come out off full screen

  • @jkmediacromer990
    @jkmediacromer990 3 ปีที่แล้ว

    How can you do this youtube api full screen video background, thanks

  • @pro1player143
    @pro1player143 4 ปีที่แล้ว

    How did u do the first step where you went to the coding thing

    • @dcode-software
      @dcode-software  4 ปีที่แล้ว +1

      Sorry, what do you mean?

    • @pro1player143
      @pro1player143 4 ปีที่แล้ว

      @@dcode-software no thank you I did some research and I got it thank you for the tutorial

  • @truongnguyenduy1424
    @truongnguyenduy1424 4 ปีที่แล้ว +1

    Verry helpful. ^^ thanks u

  • @formanhossain4155
    @formanhossain4155 3 ปีที่แล้ว

    there have any way to see fullscreen automatically when site will be loaded..?????

  • @IAmCandal
    @IAmCandal 4 ปีที่แล้ว +1

    how you make it so there doesnt have to be user interaction for it to go full screen

    • @dcode-software
      @dcode-software  4 ปีที่แล้ว +1

      You can't - and for good reason, the user's shouldn't forced into going into full screen, only when they actually interact with the web page

  • @anuragkaushik1427
    @anuragkaushik1427 4 ปีที่แล้ว +1

    How can i prevent user from exiting full screen once the full screen mode is enabled?

    • @suryavamsi8889
      @suryavamsi8889 4 ปีที่แล้ว

      i too have same doubt. Please anyone help us

    • @anuragkaushik1427
      @anuragkaushik1427 4 ปีที่แล้ว

      Bro, I don't think there's any humanity left :(

    • @ravilpatel
      @ravilpatel 4 ปีที่แล้ว

      @@suryavamsi8889 I too have same doubt bro...I am making software similar to exam.net and need to know only that thing...than my work finishes

    • @kashishsharma314
      @kashishsharma314 4 ปีที่แล้ว +1

      @@ravilpatel did you find out the answer? even i am facing the same problem, please help me if you know how to resolve it

    • @ravilpatel
      @ravilpatel 4 ปีที่แล้ว

      @@kashishsharma314 yes I got something at that time. I searched on Google that "How can I keep my text hidden untill I click on a button in HTML/CSS" and I got some links....but his was really very long ago...so don't remember the actuall things which I did. Follow all the things told in this video....and secondly give your quiz/text css to his itself.
      You will get it online on Google.

  • @Kmartguy
    @Kmartguy ปีที่แล้ว

    very helpful

  • @chakree100
    @chakree100 3 ปีที่แล้ว

    does this work on mobile versions?

  • @maya6654
    @maya6654 3 ปีที่แล้ว

    Thank you very much 😉😉😉
    Mil gracias xd

  • @TechRones
    @TechRones ปีที่แล้ว

    Can you please provide the code?

  • @Douglas-Heffernan
    @Douglas-Heffernan 2 ปีที่แล้ว +1

    now do it for iPhones

  • @KhintjoTaini
    @KhintjoTaini ปีที่แล้ว

    is it possible when website open full screen automatically

    • @learningXode-NG
      @learningXode-NG 4 หลายเดือนก่อน

      no not allowed need user input like touch events

  • @preeeby
    @preeeby 4 ปีที่แล้ว

    Thanks!

  • @Aymeric486
    @Aymeric486 3 ปีที่แล้ว

    thx a lot ;) Anybody has an https link for a PWA with a fullscreen mode example like this one? pls

  • @CreativeAvnesh
    @CreativeAvnesh ปีที่แล้ว

    It's not working on page load

    • @learningXode-NG
      @learningXode-NG 4 หลายเดือนก่อน

      it is not possible to automatically enable fullscreen mode on page load without user interaction due to browser security policies. Browsers block fullscreen requests that are not triggered by a direct user action, such as a button click or a key press, to prevent abusive behaviors.
      You'll need to prompt the user to interact with the page first, at which point you can request fullscreen mode. This approach ensures that fullscreen is enabled only with the user's consent.

  • @MrAshuxp
    @MrAshuxp 2 ปีที่แล้ว

    how trigger fullscreen automatically

    • @kaushalprakash5531
      @kaushalprakash5531 ปีที่แล้ว

      By window.onload = function(){
      Window.requestFullscreen();
      }

  • @ericcharlier7724
    @ericcharlier7724 หลายเดือนก่อน

    The title of the page would be more appropriate if it indicated how to waste your time looking at advertising for a code that is worthless since it cannot be done automatically.

  • @tavneetsinghkhurana8432
    @tavneetsinghkhurana8432 3 ปีที่แล้ว

    how to prevent user from exiting full screen mode, i am making a quiz and dont want user to leave full screen to prevent cheating

    • @dcode-software
      @dcode-software  3 ปีที่แล้ว

      Sorry mate not possible, it's client side so end of the day the user can do what they want. If you want to prevent cheating, you need to hide it from the server side

    • @tavneetsinghkhurana8432
      @tavneetsinghkhurana8432 3 ปีที่แล้ว

      @@dcode-software i was thinking if someone clicks on esc or f11 i catch that and call a function that submits the test, is that possible?

    • @codelightsparkles2403
      @codelightsparkles2403 3 ปีที่แล้ว

      @@tavneetsinghkhurana8432 just add an event listener for the window and check e.key and do the logic

  • @ЮрийШутенко-й7ч
    @ЮрийШутенко-й7ч ปีที่แล้ว

    Best 🎉

  • @yannicktamburrini7833
    @yannicktamburrini7833 3 ปีที่แล้ว

    thx

  • @HareesIN
    @HareesIN 4 ปีที่แล้ว

    Interesting....

  • @ahmedawny1424
    @ahmedawny1424 4 ปีที่แล้ว

    you are very advancad

  • @quicklook8946
    @quicklook8946 2 ปีที่แล้ว

    How to after login on full screen mode