Skip to content

Commit

Permalink
Merge pull request #492 from masonmcelvain/preserve-history
Browse files Browse the repository at this point in the history
Preserve navigation history
  • Loading branch information
masonmcelvain authored Nov 23, 2023
2 parents 1dd7244 + be333eb commit 6f3cf78
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/lib/webextension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ export function setNextStoredLinkId(id: number): void {
}

export async function navigateCurrentTab(url: string): Promise<void> {
await getCurrentTab().then((tab) => {
browser.tabs.update(tab.id, { url });
});
const tab = await getCurrentTab();
if (tab.url) {
await browser.history.addUrl({ url: tab.url });
}
await browser.tabs.update(tab.id, { url });
window.close();
}

Expand Down
2 changes: 1 addition & 1 deletion src/public/chrome/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"48": "/icons/hop48.png",
"128": "/icons/hop128.png"
},
"permissions": ["storage", "tabs"],
"permissions": ["history", "storage", "tabs"],
"commands": {
"_execute_action": {
"suggested_key": {
Expand Down
2 changes: 1 addition & 1 deletion src/public/firefox/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"48": "icon.svg",
"96": "icon.svg"
},
"permissions": ["storage", "tabs"],
"permissions": ["history", "storage", "tabs"],
"commands": {
"_execute_action": {
"suggested_key": {
Expand Down

0 comments on commit 6f3cf78

Please sign in to comment.