Skip to content

Instantly share code, notes, and snippets.

@msrivastav13
Last active May 15, 2017 16:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save msrivastav13/c84d835d13574d8403f0 to your computer and use it in GitHub Desktop.
Save msrivastav13/c84d835d13574d8403f0 to your computer and use it in GitHub Desktop.
Add the scrolling behavior for iframe embedded in visualforce inside SF1 app
<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