Closed wxmiked closed 10 years ago
Is the map in an iframe? If so, see https://github.com/Leaflet/Leaflet.fullscreen/issues/9#issuecomment-29341523. If not, can you please provide some code that demonstrates the issue?
Thanks for the quick response. Not an iframe. Here's a sample code that demos the issue.
Ah, I see what's happening. Here's a quote from the MDN documentation:
NOTE: Fullscreen requests need to be called from within an event handler or otherwise they will be denied.
I didn't know this before, but it makes sense. You wouldn't want any website to be able to pop up a full screen ad when it loaded. That means you're out of luck -- it's not possible to enter fullscreen mode automatically a few seconds after everything has loaded. Sorry!
Thanks. That's what I suspected.
I did figure out a workaround that might work for others. In Firefox you can set full-screen-api.allow-trusted-requests-only=false
in the about:config settings to allow the sample code above to work. I'm using this code as part of a kiosk and it will be locked down, so this is not a security problem for me.
I'm trying to get a Leaflet map to enter fullscreen mode a few seconds after everything has loaded.
map.toggleFullscreen();
seems to do nothing when I call it in 0.0.3. I've also tried using jQuery to "click" the fullscreen button withjQuery('.leaflet-control-fullscreen-button').trigger('click');
.I've tested this in both Firefox and Chrome and it does not work in either upon load. If I manually click the fullscreen button with the mouse, it works just fine and as expected. Any ideas why this would be the case?