Closed jaxne closed 8 years ago
I utilized a simple Javascript function to fix this issue. I added the following JavaScript function below the Reveal.initialize script on the main reveal presenation html file.
//Open Links in App Mode
function navigator_Go(url) {
window.location.assign(url); // This technique is almost exactly the same as a full <a> page refresh, but it prevents Mobile Safari from jumping out of full-screen mode
};
Then for the the link you want to stay in "App Mode" set the href to call the javascript funtion with the URL... example below:
<li class="slide-menu-item"><a href="javascript:navigator_Go('http://example.com/link/');">External link to open in iOS app mode.</a></li>
Hope this helps anyone who is using Reveal.js in this manner. Many thanks to Greg Denehy for this Menu add-on!
We are using the reveal.js presentation with the reveal.js-menu as an HTML5 mobile app presentation in the chromeless safari App Mode. So far it is working great!
Per the tutorial, I have "link.html" file with the two list item links for Resources in the above screenshot example. The calculator link should open a a new webpage we have in within the same "app mode" view window. By default iOS opens any links as a new tab in mobile safari vs. staying in App Mode. It doesn't matter if you remove the target="_blank", iOS will still open mobile safari in a new tab. I found one fix which is to write the link tag like the following using an in-line javascript call to change location.
<li class="slide-menu-item"><a href="javascript:this.location = '/calculator/'">Economic Calculator (beta)</a></li>
This does work on the iPad view and loads the page within App Mode View. However, we do have some folks using this in a regular browser and this call doesn't work. Wondering if anyone knows of a way to modify the Custom Menu Panels XMLHttpRequest code (line 442 of menu.js) to open the URL via a javascript location call vs. how it does it now.
A side note: Chrome inspector shows that the xhr.open( 'GET', element.src, false ); has been depricated not sure how crucial that is, but thought I'd mention it.
line 466 of menu.js
I realize this might not be considered a bug for typical browser use, but I thought it could help others who end up using Reveal.js as an HTML5 app presentation and want to link to other pages and maintain the app mode view. Thanks.