I use a gesture to do a page back in Firefox. I like to extend this with:
if pageback fails due to not available, close the active tab. Is this possible natively in BTT?
Any help is appreciated, thanks!
I use a gesture to do a page back in Firefox. I like to extend this with:
if pageback fails due to not available, close the active tab. Is this possible natively in BTT?
Any help is appreciated, thanks!
It looks like Firefox doesn't have a menu bar item for going back or am I just not seeing it? BTT can check the enabled state of menu bar items, that would allow to do this... but looks like Firefox is doing it differently than any other browser.
Hey Andreas, Cmd + [ takes you (page)back in Firefox. So my gesture does the Cmd + [ but i like to test if front tab doesn't change after the Cmd + [ I like Cmd + W to close the tab. If it's only possible by menu status, can it be done by script? By the way can it not also be tested by url change (Cmd + L) ?
Unfortunately I don't know much about Firefox's scriptability. Checking the menu bar would have been easy, but that doesn't seem to be an option ;-(
Too bad....thx anyway. Testing for url changes after previous action would be a nice thing to have
unfortunately BTT can do that for almost all browsers, but not for Firefox because they don't offer a way to get the current URL.
I sometimes try to switch to Firefox but am always disappointed in the lack of such basic features ;-(
In Safari it's as easy as
tell application id "com.apple.Safari" to set currentTabUrl to URL of front document
In any chrome based browser you'd just do
tell application id "org.chromium.Chromium" to set currentTabUrl to URL of active tab of front window
But for Firefox there is nothing like that.
Cmd + L, Cmd + A, Cmd + C get's it in the clipboard
yes, but scripting that is a whole lot more difficult to do reliably
Here is a simple example that would work in all browsers but Firefox:
exported_triggers.bttpreset (6.1 KB)
You could try to adapt it so use cmd+l cmd+a cmd+c then compare the clipboard contents, but it will be more complicated. You can get the clipboard content in scripts via
let content = await get_clipboard_content();
Can imagine, keep hoping for the future
I'll give it a try, Thx!
exported_triggers2.bttpreset (10.8 KB)
I see what you mean. I found this which seems to work to get the active url without the GUI flashing.
"Since Firefox 87 you can use native AppleScript GUI scripting to get the current URL. That's because Firefox now has support for VoiceOver.
First enable Firefox support for VoiceOver by going to about:config and setting the accessibility.force_disabled property to -1. Note that VoiceOver doesn't have to be enabled, only the support in Firefox. (Extra info at [2].)
After that, you can use:
tell application "System Events" to get value of UI element 1 of combo box 1 of too"
unfortunately that is also a very hacky solution as it doesn't really refer to a fixed item, but instead relies on the UI not changing (I'd not be suprised if this would not work anymore with current Firefoxes). Also it requires voice over support to be enabled, which is a huge performance hog (I'd recommend not to do this).
it works, just tested. activating voice over is only within firefox not req. in macos. don't know if this makes any difference regarding perf. hogging
yes, unfortunately it has big performance impact, which is why it is disabled by default ;-(
Maybe there is a Firefox extension that would allow for this feature without such hacks? (Back to Close WE – Get this Extension for 🦊 Firefox (en-US) sounds vaguely related)
don't see any memory or cpu spikes in activity monitor at the moment. Using M2 Pro 16GB ram. Firefox 130.0 (64-bit)
it is especially noticable on websites with larger DOM's, because every element needs to be made accessible by the browser. (Not necessarily memory or cpu, but browsing performance)
hmmm... will check Back to Close WE plugin out
Plugin seems to do the trick
After using the plugin I noticed that it doesn't always close a tab that does not have a page back. Removed the plugin as it also needed access rights to the pages. Solved it nog by using BTT for the trackpad gesture and calling a KBM macro which checks for the back button and does the page back or close tab quick and reliable. I tried the KBM part first with BTT but could not get the behaviour right for checking image of the pageback button for some reason.