I have had a long-standing bug for Webviews on Floating Menus, where nothing happens when an external link is clicked, I am not redirected to the browser, I have tried changing the default browser several times but nothing happens.
I'll need to provide the external URL configuration to the floating menu webviews. For now you can paste this user script:
let openFunc = async (url) => {
//make use of BTT's Open URL action:
let actionDefinition = {
"BTTOpenURLBrowser" : "Default",
"BTTPredefinedActionType" : 59,
"BTTOpenURL" : url,
}
let result = await trigger_action({json: JSON.stringify(actionDefinition), wait_for_reply: false});
}
window.open = openFunc;
// overriding like this will open any a href link in the external browser. You could modify this to only apply to external links, e.g. by checking whether it starts with http before passing to openFunc
document.onclick = function (e) {
e = e || window.event;
let element = e.target || e.srcElement;
if (element.tagName == 'A') {
openFunc(element.href);
return false; // prevent default action and stop event propagation
}
};
Thank you for the solution, it works on Webview with ChatGPT or Google Gemini, but I also use a Webview with Perplexity.ai, on this one the script does not work on all external links.
Thank you for adding the feature. I just did the update, it works perfectly. How do we use the "Hide Floating Menu If System Browser Has Been Opened" option?
Thank you for the correction. I tried it just now. I checked the option, but when I click on a link in a WebView and get redirected to the browser, the floating menu doesn't hide. It stays in the foreground.
Thank you, it's working correctly now, perfect. I just noticed a small bug in some cases when trying to open links on WebViews with Google Gemini or Perplexity, nothing happens and the window closes.