this is probably extremely simple but I am a total newbie. I want to add something in the beginning of an URL, like this:
orignial URL: https://www.example.com/new-article
and with the bookmarklet I want to make the URL looks like this
https://testtool.com/testing-tool#url=https://www.example.com/new-article
I tried something like this
javascript:(function() {window.location=window.location.toString().replace(/^https:\/\/www\./,'https://testtool.com/testing-tool#url=https';})()
but it isn't working.
Can you help me?
Not sure why you would be replacing when you are just taking the current URL and sticking it on as a hash
window.location = 'http://www.example.com#url=' + window.location.href
or
window.location = 'http://www.example.com#url=' + encodeURIComponent(window.location.href)