DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far...

Welcome! This is a Q&A website for computer programmers and users alike, focused on helping fellow programmers and users. Read more

What are you stuck on? Ask a question and hopefully somebody will be able to help you out!
+4 votes

What I would like to do is to get a live view (in real-time) of the javascript state of a live website, and be able to change it manually. Including variables, timers, etc. I need this because I use a website to watch videos on, but the website auto-refreshes every 5 minutes and the video restarts from minute zero every time. I cannot disable javascript because the video won't play at all. Is it possible to see all the "active" variables and objects with Firefox and tweak them, for example change a timer?

by

1 Answer

+1 vote

It might be possible, but it's most certainly tedious. Shipped JavaScript usually is minified if not uglified, which means it's pretty damn hard to read as a human. If you're lucky, there is some mapping included which allows browsers to display a more debugging friendly version - as it seems to be the case with this very website: https://imgur.com/a/M3d5bpG

If you're going for it anyway though, you'll have to read the website's code to find the relevant function (either the one doing the reload or the one declaring the timer I'd say). If you're lucky, there is an ordinary global variable declaring the starting value of the countdown. In the console tab of the developer tools, you're able to define JavaScript of your own. I believe it should be possible to copy the existing function definition from the page, paste it there (there is also a multiline editor in Firefox nowadays), and delete what annoys you. If I'm not wrong, this could "shadow" the page's definition of the function, leaving you without the annoyance.

by
Contributions licensed under CC0
...