-
EliteInsitesAsked on April 7, 2025 at 7:00 PM
Can some please explain why Jotform includes the following line in their iframe embed code:
onDISABLEDload="window.parent.scrollTo(0,0)"
This is forcing the browser to scroll to the top of the page every time the iframe finishes loading. If a user is navigating leaves the page at a certain position, and then clicks the browser's back button (and the page with the iframe is reloaded), the page jumps to the top—breaking expected navigation behavior and frustrating users. They should be returned to the exact place on the page where they left.
According to ChatGPT... "This is an outdated (and generally bad) practice that Jotform still includes in their embed code for reasons that may have made sense in some edge cases (e.g., mobile behavior or full-page embeds), but it's not necessary and causes the exact issue you're describing."
Any explanation would be appreciated. I have simply been removing the "onload" line in the code when I embed my forms, but I'd like to know why it's there in the first place.
-
Jessica JotForm SupportReplied on April 7, 2025 at 9:29 PM
Hi EliteInsites,
Thanks for reaching out to Jotform Support. I have forwarded your thread to our relevant team. As soon as we heard back from them, we'll circle back to this thread and let you know.
We appreciate your patience and understanding in this.
-
EliteInsitesReplied on April 7, 2025 at 9:34 PM
Jessica,
Actually, I just noticed when I copied the code from the iframe embed, somehow it changed. The line I'm referring to is this...
onDISABLEDload="window.parent.scrollTo(0,0)" -
EliteInsitesReplied on April 7, 2025 at 9:35 PM
Okay, I don't know why the editor keeps adding the word "DISABLED" into the code, but the line is this...
onload="window.parent.scrollTo(0,0)"
-
EliteInsitesReplied on April 7, 2025 at 9:36 PM
Not sure why Jotform's support threads don't allow one to edit or delete posts.
-
Raymond JotForm SupportReplied on April 7, 2025 at 10:18 PM
Hi EliteInsites,
Editing answers is not recommended, as it wouldn't notify our team that you've responded to your thread. I've forwarded this information to our developers for investigation. Once we have an update, we'll let you know.
In the meantime, consider using other embed codes if you're having an issue with the iFrame code. Let me show you how:
- In Form Builder, in the orange navigation bar at the top of the page, click on Publish.
- In the menu on the left side of the page, click on Embed.
- Now, select the embed option you want to use, and click on Copy Code. (I used the iFrame method only to show in this case.)
- Paste your code into your webpage's embed area, and that’s it.
Reach out again if you have any other questions.
-
EliteInsitesReplied on April 7, 2025 at 11:11 PM
Raymond,
Thank you. I'm familiar with all the various ways to embed Jotforms (I've been a Jotform customer since 2013.) The issue with the scrolling isn't limited to the iframe embed. It also happens when using the basic JS snippet script. Embedding via the source code works, but is (in my opinion) overkill.
As I stated in my earlier post, I simply remove the lineonload="window.parent.scrollTo(0,0)"
which effectively solves the problem, but I'm still wondering why it's there in the first place. Perhaps there's a specific reason I am unaware of? -
Raymond JotForm SupportReplied on April 7, 2025 at 11:25 PM
Hi EliteInsites,
As webpages are different from each other, this code is included by default to ensure that the user is able to view the iFrame content on page load. Sometimes, user may immediately scroll down to a webpage even before the iFrame completely loads which can cause it to be missed. If this is not needed by the form owner, it can be removed as needed.
I've also forwarded your feedback to our developers and if we have any feedback, we'll let you know as soon as possible.
Thanks for your patience and understanding.
-
EliteInsitesReplied on April 7, 2025 at 11:30 PM
Raymond,
Thank you for the explanation. I suspected it was something along those lines.
Your Answer
Something Went Wrong
An error occurred while generating the AI response. Please try again!