-2

I'm new to Javascript.

I think it's a Javascript function. To elaborate, is there a way to make a bookmark with a function to add something behind the ".com"?

For example the function will be in the bookmarks and when I click it, it will add what I typed in it like if I'm on tumbr. The function will have "add '/archive' after '.com' function" and it will instantly add it.

Before: www.thisisjustanexample.tumblr.com After: www.thisisjustanexample.tumblr.com/archive

Can someone direct me to what this function is called? And if you know how to type the code if it's a simple one.

CC BY-SA 3.0
0

1 Answer 1

0

You can create a bookmark with this kind of url: javascript:window.location = window.location + "/archive" (tested, it works :))

CC BY-SA 3.0
2
  • okay! but what if there were some things after the ".com" would there be a way to specifically putting the code right after .com?
    – raskyl
    Jan 31, 2017 at 9:14
  • Maybe using a replace and a regexp. (.replace(/(https?:\/\/(.+)\.com)(\??.*)/, "$1/archive$2")
    – Nico
    Jan 31, 2017 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.