Skip to content

Instantly share code, notes, and snippets.

@CTurt
Last active January 24, 2021 13:47
Show Gist options
  • Save CTurt/455286b909c847692fd1099736d81f31 to your computer and use it in GitHub Desktop.
Save CTurt/455286b909c847692fd1099736d81f31 to your computer and use it in GitHub Desktop.
Bookmark specific location within page without any id attributes; only works for pages that allow iframe
data:text/html,<html><body style="margin:0; padding:0;"><iframe id='i' src='http://forecast.weather.gov/MapClick.php?CityName=Las+Vegas&state=NV&site=VEF&textField1=36.175&textField2=-115.136&e=0' width=100% frameborder=0 margin=0 scrolling=no style="height: calc(100vh + 170px + 200px);"></iframe></body><script>window.scrollTo(0, 170);window.onscroll = function(e) {if((window.innerHeight + window.scrollY) >= document.body.offsetHeight - 200) {document.getElementById('i').style.height = window.innerHeight + window.scrollY + 200;}};</script></html>
@CTurt
Copy link
Author

CTurt commented Jan 24, 2021

The trick is, we can't get the height of the page, so we just hijack the scrolling event to make the page taller once we approach the bottom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment