A Chrome Manifest V3 extension prototype for experimenting with "smart" browser navigation at history boundaries.
The goal is to make back and forward commands do something useful even when the current page cannot go back or forward any further.
- If the current tab can go back, navigate back.
- If it cannot go back:
- close the current tab by default
- or, when configured, only close tabs that were opened from another tab
- If the current tab is the last tab in the window, close the window instead.
- If the current tab can go forward, navigate forward.
- If it cannot go forward:
- open a blank tab by default
- or do nothing when the fallback is disabled
The popup provides:
- current platform display
- resolved shortcut display from
chrome.commands.getAll() - manual
Smart Back/Smart Forwardbuttons - settings for:
closePolicy:always-closeoropener-onlyforwardFallback:open-blank-taborno-op
- latest recorded action result
Implemented:
- native Chrome Extension MV3 structure
- background service worker
- popup UI with settings and diagnostics
- storage-backed settings and last action state
- opener tab tracking via
webNavigationandopenerTabId - history boundary handling for tab close / window close / blank tab fallback
- self-contained
chrome.scripting.executeScript({ func })navigation probing - unit tests for navigation planning logic
Not implemented:
- options page
- release packaging workflow
- extension store publishing metadata
- a fully reliable solution for macOS native text-editing shortcuts inside inputs
Current command suggestions in manifest.json:
- macOS:
smart-back:Command+Leftsmart-forward:Command+Right
- Windows/Linux:
smart-back:Alt+Leftsmart-forward:Alt+Right
These are only suggested bindings. Chrome may still prioritize browser or system shortcuts over extension commands in some cases.
src/
background/ background service worker
lib/ shared logic for storage, navigation, planner, opener tracking
popup/ popup HTML and TypeScript
types/ shared app types
manifest.json MV3 manifest source
tests/
*.spec.ts Vitest unit tests
docs/
known-issues.md current product/technical limitations
Install dependencies:
pnpm installRun checks:
pnpm typecheck
pnpm test
pnpm buildWatch build output during development:
pnpm devThe production-ready unpacked extension output is written to dist/.
- Run
pnpm build. - Open
chrome://extensions. - Enable Developer mode.
- Choose
Load unpacked. - Select the
dist/directory.
After reloading the extension, validate both popup actions and keyboard shortcuts. The popup is the easiest place to confirm whether the core logic is working independently of shortcut routing behavior.
- A normal page with back history:
smart-backnavigates back
- A normal page without back history:
smart-backcloses the tab
- A window with a single remaining tab:
smart-backcloses the whole window
- A page with forward history:
smart-forwardnavigates forward
- A page without forward history:
smart-forwardopensabout:blankby default
- Popup setting changes:
closePolicyandforwardFallbackpersist across popup reopen
- Restricted pages:
- unsupported pages should not crash the extension
chrome.scripting.executeScriptcannot run on all page types, such as Chrome internal pages.- Shortcut interception is ultimately constrained by Chrome and the host OS.
- On macOS, using
Command+Left/Command+Rightconflicts with native text-editing expectations in focused inputs.
See docs/known-issues.md for the current conclusion on that last point.