'How do I edit a bookmarklet to replace slashes with plus signs, but then add back in a new URL at the beginning?
I need the bookmarklet to do this:
- Replace all slashes with plus signs.
- Add a new set of text to the beginning, before what was done in step 1.
- Open the new URL in a new tab.
For example:
- Turn the present page that's open, say https://example.com/files/other/finally, into https://example.com+files+other+finally.
- Isolate those items after the primary website name (files+other+finally) and add https://example.com/documents/pages/ to the start, to make it turn into https://example.com/documents/pages/files+other+finally.
- Open that final URL in a new tab.
I've tried several things like location.href.split("/").pop()) and others. But I'm completely new to this, so it's confusing, and I'm hoping someone can swoop in to make me understand this.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
