-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firefox Portable #13
Comments
It has stopped working for me. I am using Firefox 99.0b6 |
It works again after disabling Tampermonkey |
Indeed, thanks for pointing it out. Hope the conflict gets resolved in future versions. |
@Hvalfisk Thanks for updating this thread with the fix; I wasn't using Tampermonkey much anyways, and now Back to Close works again. :) |
This isn't unique to Firefox Portable, it also happens on the Mac version, etc. It's been reported in the Tampermonkey issues here: Tampermonkey/tampermonkey#1566 Not working on Firefox 106 Mac, or Firefox Developer Edition 107.0b5, with TamperMonkey 4.18.0, or Beta 4.19.6171 installed, when doing "open link in a new tab". The "back" button in the new tab doesn't show any history. It still works if you open a new tab and enter a URL. Tampermonkey needs only to be installed, without any scripts active. Unchecking "Enabled" from the Tampermonkey menu doesn't help - you have to disable it completely with the addons manager. The following lines appear in the browser console when you do "open link in new tab" with Tampermonkey installed, which are not there when it isn't:
|
Tampermonkey injects a history entry on its own. So this incompatibility with Tampermonkey could be fixed, by adding one to the required length where not a new tab code: source.replace('__PUSH_STATE__', tabs[tab.id].push).replace('__REQUIRED_LENGTH__', tabs[tab.id].newtab ? 2 : 1), making it code: source.replace('__PUSH_STATE__', tabs[tab.id].push).replace('__REQUIRED_LENGTH__', tabs[tab.id].newtab ? 2 : 2), on line 58 of background.js, but only if Tampermonkey version 5+ is used. To check the installed Tampermonkey version the following code could be used, with the permission management in the manifest: browser.management.getAll().then((addons) => {
var tampermonkey = addons.find(i => i.id == "[email protected]" && i.name == "Tampermonkey");
console.log("uses new tampermonkey: " + (tampermonkey != null && tampermonkey.enabled && tampermonkey.version.split(".")[0] > 4));
}) I don't know whether it makes sense to include a special check for this. An additional option would also be sufficient. |
@CennoxX - thanks for this! I tested it by changing the one line ending from 1 to 2 as you said, and loading the extension in the latest Firefox Developer Edition on macOS, along with Tampermonkey. It does restore the "back to close" function for tabs opened from the context menu "open link in new tab", which had been broken as I described above. Unfortunately, it's inconsistent in some cases. For example, doing "open link in new tab" with this png link does work without the modification, but with it, sometimes it functions with the back button closing it, but sometimes doesn't have an active "back" button. Some links that automatically open in a new tab with My Javascript skills aren't good enough to fix it myself. It looks like the developer, @jsmnbom hasn't been around for a long time, and I guess may not respond. Hopefully someone else can take it on! |
@ElhemEnohpi Could you test this new fix, that should work with and without Tampermonkey? Line 34 in aedc707
check all times for both history.length = 1 and 2 if (__PUSH_STATE__ && (history.length === 1 || history.length === 2)) { This seems to work for me... Edit: |
@CennoxX Unfortunately that doesn't seem to work for me at all. A tab opened with "Open Link in New Tab" has no active back button or history entry. I'm not sure if you meant this fix to be in addition to the other one in background.js, or as a replacement. I tried it both ways, but neither works. |
Stopped working on FF Portable since some time ago, changing settings, updating FF didn't help.
The text was updated successfully, but these errors were encountered: