From 7639dce85f0e526765c9db9a9bd81cdc82a9db26 Mon Sep 17 00:00:00 2001 From: Ramon Mi Date: Thu, 5 Mar 2026 16:55:10 +0800 Subject: [PATCH] fix: use URL fragment PDF page number for Chrome/Edge/Firefox on Win OS fixes: https://forums.zotero.org/discussion/130135/bug-zotero-8-0-3-custom-pdf-handler-chrome-fails-to-open-file-from-attachment-info-pane --- chrome/content/zotero/xpcom/fileHandlers.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/fileHandlers.js b/chrome/content/zotero/xpcom/fileHandlers.js index 5a9bc2834b..77fa7483af 100644 --- a/chrome/content/zotero/xpcom/fileHandlers.js +++ b/chrome/content/zotero/xpcom/fileHandlers.js @@ -283,7 +283,18 @@ Zotero.FileHandlers = { _handlersWin: { pdf: [ { - name: new RegExp(''), // Match any handler + name: /chrome\.exe|msedge\.exe|firefox\.exe/i, + async open(appPath, { filePath, page }) { + let args = [Zotero.File.pathToFileURI(filePath)]; + if (page !== undefined) { + // Chrome/Edge/Firefox uses URL fragment for page number + args[0] += '#page=' + page; + } + await Zotero.FileHandlers._checkAndExecWithoutBlocking(appPath, args); + } + }, + { + name: new RegExp(''), // Fallback for other handlers async open(appPath, { filePath, page }) { let args = [filePath]; if (page !== undefined) {