facebook

window.screen.height not working on real phone: false neg

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #330931 Reply

    Unknown Author
    Participant

    All I want to do is measure screen height. “variable=window.screen.height” and “variable=screen.height” both work in the emulator, but not on my iPhone 4S with iOS 6.

    -1TC

    #330935

    support-michael
    Keymaster

    @1thinchip

    Did this api work on previous versions of ios or iphone/ipad devices?

    Did you try googling stackoverflow for known issues with such js code?

    #330937

    Unknown Author
    Participant

    To be clear, I’m talking about an iOS native app.

    I don’t know if it worked on previous versions. I do not have the resources to determine this.

    From the googling I’ve done, it seems like window.screen.height is the way to do it in HTML5.

    -1TC

    #330947

    support-michael
    Keymaster

    Perhaps there is bug in your code somewhere. The api works fine. You can verify this quickly

    enter the following statement in mobile safari address bar

    alert(screen.height)

    Or you can try out this simple mobione UI that displays the display height and width
    See attachment screen_size_snippet.mobi

    Attachments:
    You must be logged in to view attached files.
    #330949

    Unknown Author
    Participant

    Perhaps I need to convert it to an integer?

    At the moment, I am saying n=window.screen.height; then displaying it to the screen to see if it works ($(#m1-pagename-textwidgetname).text(n); this fails) then an if statement to go to a page based on if n is over/under 500: phoneui.gotopage(‘m1-pagename’)- also fails.

    Given that it’s not displaying it to the screen or doing the gotopage, something’s wrong here.

    This all works perfecty in the emulator. Fails on real hardware.

    -1TC

    #330950

    support-michael
    Keymaster

    did you look at the example I provided? It works on iphone5/ios6. I tested it there and in mobile safari before posting it.

    #330951

    Unknown Author
    Participant

    It’s 6am here – will let you know in a few hours 🙂

    #330952

    support-michael
    Keymaster

    I understand completely. It’s 5AM here atm.

    #330963

    Unknown Author
    Participant

    Ok, that works as a native app.

    Where am I going wrong here?

    
    phoneui.documentReadyHandler = function() {
    
    n=window.screen.height;
    
    if (n < 500)
     {
      phoneui.gotoPage('m1-page1', 'NONE');}
    if (n > 500)
     {
      phoneui.gotoPage('m1-page2', 'NONE');}
    }
    

    Note: page1 and page2 are included in the project during compliation.

    -1TC

    #330967

    Unknown Author
    Participant

    Well, I’m embarased to say that I think it may have been an capitalization issue. “HomeScreen_custom.js” versus “Homescreen_custom.js”, as it seems to be working now.

    Thanks for your help!
    -1TC

    #330968

    support-michael
    Keymaster

    @1thinchip

    Those things happen. Thanks for following up. We will close this thread now.

Viewing 11 posts - 1 through 11 (of 11 total)
Reply To: window.screen.height not working on real phone: false neg

You must be logged in to post in the forum log in