Bookmarklets replaces the URL in the address bar
-
When you trigger a JavaScript bookmarklet it replaces the URL in the address bar. This is inconsistent with other browsers, looks strange, and the user loses the url. The url should not change when triggering a bookmarklet.
-
As a workaround, you can either
- clone the tab after the URL has been replaced to recover its URL, or
- add
if(history.replaceState){history.replaceState({},null,location.href);};
as the last command in the bookmarklet, i.e. just before})();
at the end, in order for the URL in the address bar to reappear after triggering the bookmarklet.
-
I can't believe they still haven't fixed this, Vivaldi must be the only browser that doesn't handle bookmarklets correctly.
@valiowk said in Bookmarklets replaces the URL in the address bar:
if(history.replaceState){history.replaceState({},null,location.href);};
I tried you trick @valiowk, but I can't get it to work. The URL still contains the JavaScript code. I even tried with a setTimeout around the replaceState, but that didn't help.
-
@postbb This bug was previously fixed when the code for the address bar was rewritten (I was able to remove the workaround extra code from my bookmarklets previously), but has returned as a regression, and you're correct that the old workaround no longer works anymore. I've reported the bug as VB-66045.
-
@valiowk said in Bookmarklets replaces the URL in the address bar:
I've reported the bug as VB-66045.
Thanks for reporting the bug! Are there some way to follow the status of a bug?
-
@valiowk
workaround worked for me today 2020-04-22, with Vivaldi 3.0.1874.23 (Stable channel) (64-bit) on Windows 10 OS Version 1903 (Build 18362.778),
but I thought that (); (open & close paren & semicolon) that I have at the end of my bookmarklets was supposed to do what the workaround fixes. I'm guessing it won't be fixed unless Chrome fixes their stuff for Chromium. -
I confirm this misbehaviour still occurs.
@ayespy (@Gwen-Dragon left, apparently), why was VB-66045 closed as invalid?
Can you reopen it after reading this topic, maybe changing its category or something? -
@jesus2099 Your issue was a duplicate of VB-18245
"javascript stays in address bar" which was fixed in 2020.
Sorry to say, but fixed bug reports are not reopened as i know.I am unhappy, that bug regressed and came back.
My new report is VB-82445 "[Regression] javascript stays in address bar" – was Confirmed.