I wrote this bookmarklet:
Basically it’s a tiny bookmarklet to allow a user to auto-scroll to a specific point in a long list of videos on YouTube. I wrote it for a friend of mine who repeatedly navigates to the same page over and over, and wanted to try and save some time and prevent from having to manually scroll through all the videos every time he wanted to return to the exact same spot.
When I click this bookmark in my browser (I use Opera) it works just fine. When I open the same bookmark in Firefox (he uses Firefox) it redirects me to a page that says “this page is hosted on your computer” and it simply says
(object Window). This is because, in Opera when I would run my code it would print out “input scroll distance”, because the last expression evaluated to that. To fix that, I simply pointed to the
window object, causing the final expression to evaluate to the page itself. This fixed the problem for Opera, but for Firefox it doesn’t fix the issue… Instead of just rendering the page like usual, it simply outputs a textual representation of the
Is there any way around this? I assume this is for security, and if so then there probably isn’t a workaround… But perhaps there’s something I could do to make Firefox stop behaving this way?
When I run this same exact code from the dev console it works perfectly as expected, the problem only occurs when I save it as a bookmarklet and click on it. Any ideas?