As part of work, the same webapp is hosting at multiple location for different units
e.g.
http://site1.come/path-to-some-page
http://site2.come/path-to-some-page
Now I have a bookmark for site1 saved as
http://site1.come/path-to-some-page
but for site2 I will have to again create a new bookmark. I have to deal with a new domain name each week, it is pain to do this task again and again each week.
Can I not save bookmarks relative to current host
E.g.
http://{CURRENT_HOST}/path-to-some-page
This will save me lot of pain of saving bookmark for each new website
At the top right, click More Bookmarks Drag a bookmark up or down, or drag a bookmark into a folder on the left. You can also copy and paste your bookmarks in the order you want.
You can copy a bookmark from a folder into another. For chrome, menu -> bookmarks -> bookmark manager, find the bookmark right click, copy, go to another folder and paste it. For firefox, click the icon on the right of the star icon and 'show all bookmarks'. The rest is the same.
javascript:void(window.location.href = '/path-to-some-page');
Is another way of bookmarking a relative path.
I haven't seen a way to save a relative or root-relative link without resorting to a bookmarklet.
As far as a bookmarklet is concerned, it's relatively easy to generate one that will take you to whatever path you'd like:
javascript:(rel=>{location=rel.startsWith('/')?`${location.protocol}//${location.host}${rel}`:`${location.protocol}//${location.host}${location.pathname}/${rel}`})('/path')
Replace 'path'
at the end with a properly escaped string containing whatever path you'd like. Note that this will differentiate between relative and root-relative paths based on whether they start with a /
character.
In long form:
(rel => {
location =
// if the relative path starts with /
rel.startsWith('/')
// go to http(s)://{domain}/{relative path}
? `${location.protocol}//${location.host}${rel}`
// otherwise go to http(s)://{domain}/{current path}/{relative path}
: `${location.protocol}//${location.host}${location.pathname}/${rel}`
// call the function providing the relative path to use
})('/path')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With