Skip to content

Commit

Permalink
iOS 12.2 fix, delay loading the streaming iframe until after render
Browse files Browse the repository at this point in the history
Wait until DOMContentLoaded on "iPhone;" and "iPad;", also wait an
extra second for good measure because I don't fully understand what bug
I'm working around.

Fixes #14.
  • Loading branch information
dgl committed Apr 24, 2019
1 parent d46b9c7 commit 917adb4
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion interfaces/interface-make/fwindowlist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,26 @@ function post_results() {
<noscript>Scripting is required for this interface</noscript>
<table class="wlist-table">
<tr><td width="1">
<iframe src="$config->{script_nph}?$string" id="iframe" width="1" height="1" style="display:none;border:0;" ></iframe>
<iframe src="$config->{script_login}?interface=**BROWSER&item=blank" id="iframe" width="1" height="1" style="display:none;border:0;" ></iframe>
<script>
var nph_iframe_src = '$config->{script_nph}?$string';
if (navigator.userAgent.match(/(iPad|iPhone);/)) {
// Apple special, iOS 12 appears to have issues with loading several resources at a time.
var wait_counter = [2];
var wait_func = function() {
if (--wait_counter[0] == 0) start_load_process();
};
setTimeout(wait_func, 1000);
document.addEventListener('DOMContentLoaded', wait_func);
} else {
// Don't delay other browsers
start_load_process();
}
function start_load_process() {
document.getElementById('iframe').src = nph_iframe_src;
}
</script>
<iframe src="$config->{script_login}?interface=**BROWSER&item=blank" width="1" height="1" style="display:none; border:0; " name="hiddenframe"></iframe>
</td>
Expand Down

0 comments on commit 917adb4

Please sign in to comment.