Run JavaScript After Page Refresh
Add a defined page action to your refresh workflow. Run JavaScript you understand after a reload—for example, highlight a heading or a row you need to inspect.
Auto Refresh PageStoppedLast refresh: —
Next refresh: —
Refresh counter: 0
Auto Refresh Page · ChromenowYour dashboard has a fresh update.
dashboard.example.comWhat this feature helps you do
Add a specific action
Extend a reload with a small operation suited to your page.
Work with page elements
Select and style a known heading, row or panel in the page's document.
Verify one clear result
Use a visible, reversible change before building a more involved workflow.
Set it up in three steps
1
Check script access
In current Chrome versions, open the extension's Details and enable Allow user scripts if the feature requires it.
2
Add a small script
In Advanced options, enable Refresh and run script and enter code whose effect you understand.
3
Run one cycle
Start a bounded timer on a page you control and check the expected result after the reload.
Start with an observable page change
This example adds a visible outline if an h1 exists. It does not send data or submit a form. Try it on a page you control and inspect the result before adding other actions.
document.querySelector('h1')?.style.setProperty('outline', '2px solid #28e232');
TargetThe page's first heading
ActionAdd a green outline
CheckThe heading is outlined after the reload
Give the script a defined scope
Start with the main document and a read-only test. A script runs in the context made available by the browser and extension; it cannot assume that every embedded frame or site element is accessible. Review site access and the chosen script event. Chrome's Allow user scripts control is separate from the option inside the extension.
Google documents the browser-side control in the userScripts reference. For a button rather than custom code, consider the auto clicker. Use the QA checklist to record your expected and observed result.
Questions about this feature
Do I need JavaScript knowledge?
Use this feature for code you can understand and review. Start with a small visible effect, then test each addition separately.
Why might script access need enabling in Chrome?
Current Chrome versions use an Allow user scripts control in the extension's Details page. The browser-side permission and the extension's own script option both need to fit the configured task.
Should I enable all frames immediately?
Start with the main page. Expand the scope only when your task needs an embedded document and you have checked the relevant access and effect.
Build the workflow you need
Set it up in Auto Refresh Page.
Choose the settings that fit your page. Start a timer, check the first cycle, and stop whenever you want.
Also available for Microsoft Edge.