Skip to content

Commit 1aa9c80

Browse files
committed
fix: close extra tabs opened by Claude extension
The Claude extension opens a second tab to claude.ai. Close all but the first tab before navigating to chrome://newtab.
1 parent 259b3d8 commit 1aa9c80

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

internal/claude/loader.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,17 @@ func LoadIntoBrowser(ctx context.Context, opts LoadIntoBrowserOptions) error {
138138
TimeoutSec: kernel.Opt(int64(30)),
139139
})
140140

141-
// Step 4: Navigate all tabs to chrome://newtab to avoid the Claude login page
142-
// The extension opens claude.ai by default which shows a login prompt
141+
// Step 4: Close extra tabs and navigate to chrome://newtab
142+
// The Claude extension opens a tab to claude.ai by default
143143
navigateScript := `
144144
const pages = context.pages();
145-
for (const p of pages) {
146-
await p.goto('chrome://newtab');
145+
// Close all but the first page
146+
for (let i = 1; i < pages.length; i++) {
147+
await pages[i].close();
148+
}
149+
// Navigate the remaining page to newtab
150+
if (pages.length > 0) {
151+
await pages[0].goto('chrome://newtab');
147152
}
148153
`
149154
_, _ = opts.Client.Browsers.Playwright.Execute(ctx, opts.BrowserID, kernel.BrowserPlaywrightExecuteParams{

0 commit comments

Comments
 (0)