Reputation: 153
Is there any way to scroll a page which has an iframe on it back to the top of that iframe when a new page loads inside the frame?
My problem is that we have a booking page and it's quite long the iframe is 1500 pixels high and generally the confirm button is about halfway down that iframe after filling out details etc but the system then sends the user to a verified by Visa/MasterCard page which is quite short and because the original page doesn't scroll back to where the iframe starts the users aren't seeing the verified box and are therefore not confirming so is there a way that every time a new page opens within the iframe my page, original page scrolls back up to where the iframe begins on the page?
Upvotes: 1
Views: 1195
Reputation: 1407
You might try something like this:
var iframe = document.getElementById("iframe_id");
iframe.onload = function()
{
iframe.scrollIntoView();
}
Upvotes: 3