iframe iOS fix for V2 code

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

If you wish to attach one or more files enter the details below.

Maximum filesize per attachment: 1 MiB.

Expand view Topic review: iframe iOS fix for V2 code

iframe iOS fix for V2 code

by axew3 » Wed Nov 21, 2018 2:28 pm

Thank to an help by friend with iPAD and iOS devices, i discovered that the fix about correct iframe centered on certain type of phpBB links, in other hand lead to a not correct result on safary and chrome on iOS, that seem for those browsers on iOS the fix isn't required.
To resolve the bug, the iframe code added into overall_footer.html has been easily updated (deeply tested working fine now on any device and OS)

Code: Select all

// fix vertical iframe centered on viewtopic.php, preview or where # anchor etc
$(window).load(function() {
var bd = document.getElementsByTagName("body");
for (var i = 0; i < bd.length; i++) { 
    var bdID = bd[i].getAttribute("id"); 
}
var elt = document.getElementById(bdID);	
elt.setAttribute("style", "position:fixed;top:0%;left:0%;width:100%;margin:0px;");
});
changed into:

Code: Select all

// fix vertical iframe centered on viewtopic.php, preview or where # anchor etc
// skip iOS
var w3iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
if(w3iOS == false){
$(window).load(function() {
var bd = document.getElementsByTagName("body");
for (var i = 0; i < bd.length; i++) { 
    var bdID = bd[i].getAttribute("id"); 
}
var elt = document.getElementById(bdID);	
elt.setAttribute("style", "position:fixed;top:0%;left:0%;width:100%;margin:0px;");
});
}
Related code on procedure hint has been updated about this. To fix just replace the code as above indicated and remember to recompile phpBB template.
wordpress phpBB Iframe procedure V2

Top