0

How would I get the below bookmarklet to open in a new tab instead of loading in place of the current page?

javascript:(function() {window.location=window.location.toString().replace(/.+\.reddit.com/,'https://www.removeddit.com').replace('.compact','');})()

I have been searching for hours but haven't been able to figure out how to implement this, it is not as simple as the examples I have found below. Can anyone offer advice on what I'm doing wrong with my script?

javascript:void(open('http://archive.today/?run=1&url='+encodeURIComponent(document.location)))

javascript:void(window.open('https://web.archive.org/web/*/'+location.href.replace(/\/$/, '')));

or the examples show at this link that I could figure out: Open a URL in a new tab (and not a new window)

Thanks in advance for any help you can offer.

  • Does this work for you? `function url_open(url) {var t = window.open(url, '_blank'); t.focus();} url_open('https://duckduckgo.com/');` – John Dec 09 '20 at 16:39
  • That does work as do most of the examples I found that only show a single function that opens a new tab in some manner, but how would I implement into my bookmarklet that already has a function that edits the url. Sorry I am a total noob with javascript. – Ashley Moore Dec 09 '20 at 16:44
  • You could post on the Meta site about the duplicate abuse though be fore-warned: I have *never* found it useful to do so. There are people on this site that are able and willing to help most of the time though your question fell prey to the fanatical "everything is a duplicate!" mental illness that plagues this otherwise useful site. Note how a *single* person could come in and kill your question though apparently it requires more than one person to open it. Try asking in the JavaScript section here: https://www.webmasterworld.com/ – John Dec 09 '20 at 21:12
  • Also this question seems like it *might* be specific to the browser you're using. I only use a customizable browser for the majority of my browsing which makes only Waterfox "Classic" with extension support which is what I'll have to use until I get to the point of paying developers to build a browser with a GUI that doesn't suck. You may find a way to use a Gecko browser (Waterfox, Firefox, etc) as they tend to be more open though they are also generally a bit buggy. In some browsers like Waterfox "Classic" you can hold the CTRL key (in Windows at least) and a bookmark will open in a new tab. – John Dec 09 '20 at 21:18
  • Couldn't agree more about this community being plagued with the "everything's a duplicate!" mindset. There are some great contributors in the community and I'm sure these knob heads are just the minority, but unfortunately this community enables those with little between the ears to swoop in and squash collaborative efforts so easily. Hopefully moderators/creators of this site/powers that be wake up and fix this or they'll become obsolete along with this site in short time. People will find a better alternative. – Ashley Moore Dec 10 '20 at 14:07
  • 1
    Thanks also for the browser suggestion Waterfox. I've never heard of it before, I will have to check it out! I should have mentioned I was using Chrome, I just tested the Ctrl-click and also middle-click opens in a new tab. I will continue exploring, thank you. – Ashley Moore Dec 10 '20 at 14:09
  • I have my own platform and eventually I'll create something to supplement/replace Stack for my own needs and it'll be developed to disallow such abuses. Right now I'm writing an email module for my web platform and I'm really making great progress (I only do quality code). In regards to Waterfox it's highly customizable and I've maintained a website to try and consolidate the more critical and important things to unlocking it's potential. You'll want to check out "Classic", not the other one though. Reach out if you need help. https://www.fixedfirefox.com/ – John Dec 10 '20 at 14:41
  • Sounds awesome, keep up the good work and keep me posted on Stack alternative, I'll be interested. Thanks for advice I will check out, I like to keep current and explore new browsers every so often and a few have stuck with me, chrome, firefox, vivaldi, tor, but each one is lacking in some way but gets the job done. – Ashley Moore Dec 10 '20 at 15:29
  • That's usually because of customization (for me); I'm a power user and my style is, "I don't need arthritis from excessive pointless clicking". One of my goals is to build a browser and an engine for it eventually. Most people's code is...I write my own code for good reason. If you're doing web design you'll want to stick to testing engines: Gecko (Waterfox, Firefox, etc), WebKit (Safari, Lunascape, Midoria, Otter and SlimBoat) and Blink (Chrome and it's fifty thousand clones) which is a fork of WebKit. Different engines can lead to different results. – John Dec 10 '20 at 16:08

0 Answers0