5

Recently started using S1. Developing a web app and trying to listen out for orientation change on iPad.

This works perfectly in full site mode on the iPad

function doOnOrientationChange() {
    switch(window.orientation) {  
        case -90:
        case 90:
        alert('landscape');
        break; 
        default:
        alert('portrait');
        break; 
    }
 }

window.addEventListener('orientationchange', doOnOrientationChange);

// Initial execution if needed
doOnOrientationChange(); 

But only once on initial page load in the S1 app.

Anyone have any suggestions or advice?

  • can you simulate an orientation change with Javascript to verify the event listener is working properly? could it be a browser-specific issue? – Scott Pelak Dec 12 '13 at 17:02
  • Has anyone found the solution to this? I've tried catching the orientationchange events through normal javascript and using jQuery Mobile but nothing gets triggered. The Salesforce1 guide doesn't provide anything except for Canvas apps. – Diego Aug 25 '14 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.