I'm building a bookmarklet and I need to replace some chars in the current URL and open it in another tab when they activate the bookmarklet.
Here is the code
javascript:setTimeout(function(){window.location.href = window.location.href.replace('foo', 'bar')}, 200)
However, I can only refresh the page in the current tab. how to open the new link in a new tab?
I am not familiar with Bookmarklets, but try this:
javascript:setTimeout(function(){
const href = window.location.href.replace('foo', 'bar')
window.open(href)
}, 200)
Let me know if it worked.