You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote a function to return clean URLs, which removes unnecessary query parameters outside the whitelist. However, for some reason, it does not work properly on Surfingkeys. I have verified it on JavaScript Playground and it should be able to work correctly.
constqueryParamWhitelistMap={"www.youtube.com": ["v","t"],"news.ycombinator.com": ["id"],};function_getCleanUrl(url){// Parse the URLconsturlObj=newURL(url);// Get the hostname and corresponding query parameter whitelistconstqueryParamWhitelist=queryParamWhitelistMap[urlObj.hostname]||[];// Use Array.filter to keep only the whitelisted query parametersArray.from(urlObj.searchParams.keys()).filter((key)=>!queryParamWhitelist.includes(key)).forEach((key)=>urlObj.searchParams.delete(key));// Return the modified URL as a stringreturnurlObj.toString();}api.mapkey("yU","Copy current tab as a clean link",function(){api.Clipboard.write(_getCleanUrl(window.location.href));});
The text was updated successfully, but these errors were encountered:
Thank you for your reply. I just tested it on Google Chrome and it works fine, but it just doesn't work on Firefox. As an alternative, I wrote a longer but more compatible replacement function that can work properly on Firefox.
Prelude
Could you find answer in below documents?
No.
Yes.
Error details
I wrote a function to return clean URLs, which removes unnecessary query parameters outside the whitelist. However, for some reason, it does not work properly on Surfingkeys. I have verified it on JavaScript Playground and it should be able to work correctly.
SurfingKeys: 1.15.0
Browser: Firefox 119.0.1 (64-bit)
URL: hhttps://www.google.com/search?q=surfingkeys
Content
The text was updated successfully, but these errors were encountered: