Last active
May 15, 2017 16:44
-
-
Save msrivastav13/c84d835d13574d8403f0 to your computer and use it in GitHub Desktop.
Add the scrolling behavior for iframe embedded in visualforce inside SF1 app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
(function() { | |
try { | |
var a = navigator.userAgent; | |
if ((a.indexOf('Salesforce') != -1) && (a.indexOf('iPhone') != -1 || a.indexOf('iPad') != -1) && (a.indexOf('OS/8') != -1 || a.indexOf('OS 8') != -1 || a.indexOf('OS/9') != -1 || a.indexOf('OS 9') != -1) && (a.indexOf('Safari') == -1)) { | |
var s = document.createElement('style'); | |
if (a.indexOf('OS/8') != -1 || a.indexOf('OS 8') != -1) { | |
s.innerHTML = "html,html body{overflow: auto;-webkit-overflow-scrolling:touch;}body{position:absolute;left:0;right:0;top:0;bottom:0;}"; | |
} else if (a.indexOf('OS/9') != -1 || a.indexOf('OS 9') != -1) { | |
s.innerHTML = "html,html body{overflow: auto;-webkit-overflow-scrolling:auto;}body{position:absolute;left:0;right:0;top:0;bottom:0;}"; | |
} | |
document.getElementsByTagName('head')[0].appendChild(s); | |
} | |
} catch (e) {} | |
})(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment