function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Leonardi KohLeonardi Koh 

Visualforce scroll non functional in Salesforce1 (iOS) ?

Hi,

i recently created a Visualforce Page utilizing BootStrap and noticed that the when viewed in Salesforce1 for iOS, the page button which was created using apex:commandButton would keep move the page to the top and not executing the appropriate method in the controller that has been linked to the commandButton.

after digging around, i found several issues which while not exactly the same appears related to an extent and they mentioned scripts that can help the issue, the one i found to be most useful was the following:
 
(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) {}
})();

and voila, it worked and the button now worked in Salesforce1 for iOS (it worked fine for Android from the start so no issue there)

I noticed however that the scroll is very rigid and absolute, ie: it has no 'slide' and thus the scroll moves at a painfully slow rate for a long page.

Does anyone ever encountered similar issue? Or perhaps had a similar problem as i had with the button moving the page to the top and have a different solution that work better than the script i used above?