on-internet
← Community

How can I avoid automatic scroll to embedded Youtube page if the video is missing?

Stack Overflow ·

When a YouTube embed is placed further down a page and the video is no longer available ("Video unavailable"), the page automatically scrolls down to that video frame on load. This scrolling does not occur with available videos. Minimal reproducible example: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <div style="padding-top:2000px"> <iframe src="https://www.youtube.com/embed/e8tnOtJpfx8" frameborder="0" height="315" width="560" allowfullscreen="allowfullscreen"></iframe> </div> </body> </html> Does

Comments

Sign in or sign up to comment and upvote.

No comments yet.