sindresorhus / screenfull

Simple wrapper for cross-browser usage of the JavaScript Fullscreen API
https://sindresorhus.com/screenfull
MIT License
7.06k stars 698 forks source link

It exits with a new request? #33

Closed marianopeck closed 10 years ago

marianopeck commented 10 years ago

Hi guys. I have a button that in which I attach the event for the click to go fullscreen. I can enter fullscreen mode but then as soon as I click on something, the fullscreen is exit. Is it its normal behavior or I am doing something wrong? At least the exit button works here.

The other possibility I am doing is to also attach a callback to such button (this is what I actually need) that does some code in the server. Doing this, I can remain in the full screen mode and I am not kicked out. However...if I try to exit full screen mode from the button, it does nothing. screenfull.isFullscreen answers false.

So..I wonder, what should I do to be able to remain in fullscreen mode even with new requests and to also have a working exit button?

Thanks!

sindresorhus commented 10 years ago

The fullscreen api is meant to be used on a single page. However there are ways to work around this by either making your page a single-page app or using this iframe trick https://github.com/sindresorhus/screenfull.js/blob/gh-pages/index.html#L202-L219

This is an issue tracker and not a support forum. Keep questions on StackOverflow ;)

marianopeck commented 10 years ago

Hi Thanks. But I don't get it the trick with the iframe. Sorry I am a noob in JS. I have lost of links/request inside my app and what I want to make fullscreen is my whole app. With the iframe trick I would need to make each button use the iframe? Is there a workaround? Thanks!

pastudan commented 10 years ago

The idea is that you make another page that only has an iframe with your main site + screenfull.js. Then when you click links inside the iframe the browser will load the next page inside that frame, rather than taking the parent page out of fullscreen and navigating away.

Like sindresorhus said, this question really belongs on StackOverflow. If you ask your question there I'd be happy to help you implement it further.

marianopeck commented 10 years ago

Hi. Thanks both for your helpful and quick answers. I opened a question here: http://stackoverflow.com/questions/19440234/how-to-make-a-whole-website-run-under-fullscreen-with-screenfull-js

I would really appreciate if you can help me since I would love to have my app running in fullscreen mode in certain occasions.

marianopeck commented 10 years ago

Hi Dan Pastusek. Is there any chance that you help me implement this solution? I have this opened question: http://stackoverflow.com/questions/19440234/how-to-make-a-whole-website-run-under-fullscreen-with-screenfull-js

Thanks a lot in advance!!!