Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8390511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:00:38+00:00 2026-06-09T19:00:38+00:00

I am hiding my address bar, in Safari on an iPhone using this script:

  • 0

I am hiding my address bar, in Safari on an iPhone using this script:

window.addEventListener("load",function() {
setTimeout(function(){
window.scrollTo(0, 1);
}, 0);
});

The problem is if the page doesn’t fully load and the user scrolls down, when it finishes loading it shoots back up again. I want to make this more defensive, so when a user moves the phone and clears the address bar themselves, it will not do it again.

This was my attempt which didn’t work:

window.addEventListener("load",function() {
setTimeout(function(){
  if(window > 1){

  }
  else
  {
window.scrollTo(0, 1);
}}, 0);
});

Just in case anyone says I was going to do a if(!window … and take out the else but wanted to keep it like this for testing purposes, marks out the possibility of me writing it wrong.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:00:40+00:00Added an answer on June 9, 2026 at 7:00 pm

    Use document.body.scrollTop instead of simply window:

    window.addEventListener("load",function() {
        setTimeout(function() {
            if (document.body.scrollTop > 1) {
                // Do your testing here...
            } else {
                window.scrollTo(0, 1);
            }
        }, 0);
    });
    

    When you’re done testing, you could collapse it all into 1 line:

    window.addEventListener("load",function() {
        setTimeout(function() {
            document.body.scrollTop || window.scrollTo(0, 1);
        }, 0);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am hiding the entire column in the grid like this? $('#Grid tr th').each(function(column)
I'm hiding a div using display:none and this div only shows when we click
I have a problem with hiding keyboard in the iPhone simulator. My HTML code:
I am showing/hiding a div depending where I click with this code: $(body).click(function(e) {
I am having a problem with hiding the navigation bar in a tab bar
I've seen plenty of scripts on the web about hiding the address bar by
I'm hiding the css class .pds-pd-link. This class styles the link www.polldaddy.com . The
I am hiding an element using inline css, like so: <span class=hidden-nojs style=display:none>Some text</span>
Today I have had a problem with hiding text with text-indent: -9999px rule. I
I am hiding a bunch of textboxes and it works fine, the problem is,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.