In ons-modal
, display Loading...
and access the website with InAppBrowser
in the hidden
state.
The loadstop
event fires upon completion of loading, so close ons-modal
to display InAppBrowser
.
However, it does not work if you specify an external browser (_system
).
ons-modal
InAppBrowser plug-in
HTML
<ons-page>
<ons-toolbar>
<div class="center">Test</div>
</ons-toolbar>
<br>
<ons-button onclick="showWeb()">Website View</ons-button>
</ons-page>
<ons-modal>
<div style="text-align:center;">
<p>ons-iconion="md-spinner" size="28px" spin>/ons-icon>> Loading...</p>
</div>
</ons-modal>
JavaScript
"use strict";
ons.ready(function(){
console.log("Onsen UI is ready!");
});
function showWeb() {
varmodal= document.querySelector("ons-modal");
modal.show();
var ref=window.open("http://ja.stackoverflow.com/", "_blank", "location=no, hidden=yes");
ref.addEventListener("loadstop", function(e){
modal.hide();
ref.show();
});
}
© 2024 OneMinuteCode. All rights reserved.