Iframe - scroll to top of page

  • Profile Image
    art_crate
    Asked on July 03, 2015 at 11:29 PM

    When using a iframe to display the form, is there anyway to use html to get the page to scroll to the top when you are going through a multi page survey?

     

    I have tried this with no success:

     <body onload="location.target="_blank" href='#top'">

     

  • Profile Image
    Boris
    Answered on July 04, 2015 at 01:37 AM

    The form should scroll to the top automatically when using a multi-page form, and clicking on Next. If this is not the case in your website, would you please be so kind to provide an URL to the exact page where you have embedded your form, so that we can take a look.

    Thank you.

  • Profile Image
    art_crate
    Answered on July 04, 2015 at 01:40 AM

    http://www.artcrate.co/home-decor-style-1-1

     

    Its very noticeable when viewing on a mobile device

    Thanks for the help!

  • Profile Image
    Boris
    Answered on July 04, 2015 at 02:01 AM

    Oh, now I see what you were talking about, and I apologize for the confusion. The form will scroll to the top of its own page (the top of the form), but it does not scroll to the top of your own website.

    This is by design of how iFrames work in general, and I'm afraid that we do not have a workaround for it on our end. It was a conscientious decision by the creators of web and iFrames that goes far back, and has valid reasoning behind it.

    As the iFrame is a page on its own inside your website, sandboxed from the rest of your website, it doesn't see around it. The iFrame doesn't know how far down on the real page it is, so it couldn't know if it is OK to jump to the top of the website page. As you are interacting with the iFrame - such as opening other URLs inside the frame - the iFrame will always jump into focus with the top of the affected iFrame being at the top of your screen.

    I hope this explanation was helpful, and I apologize for not having a solution that you desire. I hope you understand that this behavior is not something that is mandated by JotForm, but rather a feature of web in general.