ios_iframe_fullscreen.xml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <krpano>
  2. <!--
  3. ios_iframe_fullscreen.xml
  4. krpano 1.20
  5. A helper script for getting into a kind of 'fullscreen mode' on iOS
  6. from inside an iframe.
  7. iOS itself doesn't support the HTML5 Fullscreen API and so there is no
  8. way to make the pano window larger than the iframe area itself.
  9. This script therefore adds a fake-fullscreen-mode support and redirects
  10. the browser window directly to the inner iframe page to make the iframe
  11. itself beeing the full browser page.
  12. Note: this scripts only enables the fullscreen contextmenu item,
  13. custom xml elements that are depending on the 'device.fullscreensupport'
  14. state would need to get enabled manually. That's because the xml parsing
  15. and xml element 'devices filtering' is happening before this script is
  16. running. For 'manual enabling' e.g. remove the 'fullscreensupport'
  17. devices check from the related elements in the xml files.
  18. -->
  19. <action name="ios_iframe_fullscreen_redirect" type="Javascript" autorun="preinit" if="device.ios AND device.iframe AND !device.fullscreensupport"><![CDATA[
  20. // fake the fullscreen support information
  21. krpano.device.fullscreensupport = true;
  22. // enable the contextmenu fullscreen item
  23. <!-- krpano.contextmenu.fullscreen = true; -->
  24. // define a custom 'fullscreen' attribute
  25. delete krpano.fullscreen;
  26. krpano.registerattribute("fullscreen", false,
  27. function(newstate)
  28. {
  29. if(newstate)
  30. {
  31. // when setting fullscreen to true, redirect the top frame to the iframe url
  32. try
  33. {
  34. top.location = window.location;
  35. }
  36. catch(err)
  37. {}
  38. }
  39. }
  40. ,
  41. function()
  42. {
  43. return false;
  44. });
  45. ]]></action>
  46. </krpano>