Scroll down simultaneously in side-by-side browser windows
Solution 1
This can be done with AutoHotkey magic by using the
following script, which should be stored in an .ahk
file for execution.
Double-click the file to start the script, stop it by right-click in the traybar
on the green "H" icon and choose Exit.
The script is written for the coordinated scrolling of two windows. You have to select first the windows to scroll by including them one by one. The script duplicates the following keys for coordinated scrolling : Wheel Up, Wheel Down, Page Up, Page Down.
The script uses some hotkeys for initialization. You can edit it to use some other hotkeys or remove unneeded ones. The ones I chose are described below.
F1 : Starts a new group of windows
F2 : Includes the currently active window in the group
F3 : Shows the windows in the group even if minimized
F4 : Closes all windows in the group
Here is the script. It worked in my tests.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance Force
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Process, Priority, , High
SetWinDelay 0
g = 1 ; Used to generate unique group names
; Reload script to reinitialize all variables, since there is no delete group
f1::
Reload
return
; Add currently active window to the group
f2::
WinGet, active_id, ID, A
GroupAdd, grpname, ahk_id %active_id%
return
; Restore all windows in the group to be visible
f3::WinRestore, ahk_group grpname
return
; Close all windows in the group
f4::GroupClose, grpname , A
Reload
return
; This intercepts scroll keys on the active window and duplicates them on the other window
#IfWinActive ahk_group grpname
WheelUp::
WheelDown::
PgUp::
PgDn::
MouseGetPos, mX, mY ; remember mouse position in current window
Send {%A_ThisHotKey%}
GroupActivate grpname ; activate the next window of this group
If (A_ThisHotKey = "WheelUp" || A_ThisHotKey = "WheelDown")
MouseMove, 200, 200, 0 ; move the mouse over the currently active window
Send {%A_ThisHotKey%}
GroupActivate grpname ; Activate previous window
MouseMove, mX, mY, 0 ; Restore its mouse position
return
Solution 2
you can try this https://github.com/takatama/sync-scroll-chrome-extension. It is a chrome extension, just open chrome://extensions/, click Load unpacked, open code you just download, enjoy it !!
Related videos on Youtube
nmd_07
Updated on September 18, 2022Comments
-
nmd_07 over 1 year
I usually have two instances of my web browser running side by side in my screen. When I read news or an article from a foreign language, I have it translated at one browser covering the half of the screen, and the original article running in the other window covers the other half of the screen.
Now, I want to be able to scroll down two pages running on two separate instances of the same browser simultaneously so that I can compare translated and original texts. I either use Firefox or Chrome. Is there a way to make it work simultaneous scroll down feature?
-
DavidPostill over 5 yearsShort answer: No
-
harrymc over 5 years@DavidPostill: I think I know how this can be done. Will give a verified answer after some testing.
-
August almost 3 yearsI want to use synchronized scrolling in two browser windows too for the same reason: learning a language. I have a crude working solution based on using a local Websocket server and sending the
window.scrollY
andwindow.scrollX
values from one window to the other via websockets. It also works bi-directional. My solution needs a Tampermonkey script that injects Javascript code to open a websocket connection to the local server and sending data whenever there is ascroll event
I will post an answer when it's ready
-
-
Gardener about 5 yearsSuppose you had numbered paragraphs on each of the two web pages. Could autohotkey parse the webpage to keep the two pages in sync (when paragraph labeled 5. is at the top of the left window, autohotkey would scroll the right window so that paragraph 5 is at the top of the right window)?
-
harrymc about 5 years@Gardener: It probably could, but that's another (and more complicated) question.
-
Gardener about 5 yearsThank you. Most of the dual language pages I view have numbered paragraphs (Bible verses and such), so the numbering is already there. Interesting original question from the OP and great solution!
-
Carley over 3 yearsThank you, thank you, thank you! This truly is going to improve my life by several orders of magnitude. Looking forward to tweaking this at some point to add some granularity of control over scroll increment and speed. But excellent as is.
-
Vishrant about 2 yearshow do you use it? the extension got loaded, is there a key that it listens to?