It is a simple line of code and the entire site does this or add target=“_blank” to every hyperlink, and it will do the same thing. It sucks that you have to right-click every link to open in a new tab or window and it is such a simple fix.

  • krogoth@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    76
    arrow-down
    7
    ·
    1 year ago

    I prefer the current behaviour.

    It’s easy to open a link in a new tab without right clicking. You can middle click (Windows and Linux) or command+click (MacOS). However there’s no easy way to force a browser to open a link in the current tab if the site wants to use a new tab.

    • fuckwit_mcbumcrumble@lemmy.world
      link
      fedilink
      arrow-up
      38
      ·
      1 year ago

      What I hate is when you click on what’s supposed to be an image that you’d expect to expand, but instead it’s a link because the embed isn’t supported. Then when you hit back you lose your place because the page your on isn’t saved and you’ve lost your place trying to get back.

      • Archpawn@lemmy.world
        link
        fedilink
        arrow-up
        3
        ·
        1 year ago

        I made this user style to help fix that problem by outlining images, and also make it so when you click an image it expands over the page at full size up to the width of the screen.

        Though it’s not perfect. If the image is already black it’s hard to tell. You could change the outline color to something less common, but that looks ugly. Changing the boundary radius would probably be the best, but it’s already marked as !important so I don’t think I can change it. I’m open to suggestions on improving that part.

    • radix@lemmy.world
      link
      fedilink
      English
      arrow-up
      24
      ·
      1 year ago

      I was almost beginning to think I was browsing the whole web wrong by middle-click-opening a bunch of tabs, then going through them all after I’ve seen all the interesting headlines.

    • Archpawn@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      However there’s no easy way to force a browser to open a link in the current tab if the site wants to use a new tab.

      Just hit ctrl+w after clicking the link. That will close the current tab.

    • slampisko@czech-lemmy.eu
      link
      fedilink
      arrow-up
      18
      arrow-down
      4
      ·
      1 year ago

      Or Ctrl+Click to open in a new tab in the background, or Ctrl+Shift+Click to open in a new tab and switch to it. Regardless, I agree with OP that this should be the default.

    • cubedsteaks@lemmy.today
      link
      fedilink
      arrow-up
      6
      arrow-down
      2
      ·
      1 year ago

      I’m aware of this and do this but its annoying when it could just open a new link away from Lemmy because so much of being on a lemmy instance for some reason involves me keeping Lemmy in one tab so I stay logged in… because if I leave… then I have to sign back in again.

    • JoBo@feddit.uk
      link
      fedilink
      arrow-up
      10
      arrow-down
      29
      ·
      1 year ago

      Laptops don’t have middle clicks.

      Everyone knows the various workarounds. You don’t need to post them. This thread is about a problem that ought not to exist.

      • emax_gomax@lemmy.world
        link
        fedilink
        arrow-up
        18
        ·
        1 year ago

        Thats subjective. Different people have different opinions on how this should work. Making the default open in the current tab still allows you to have the alternate behaviour with ctrl+click or middle-click. The reverse does not.

        • CmdrShepard@lemmy.one
          link
          fedilink
          English
          arrow-up
          5
          arrow-down
          4
          ·
          1 year ago

          A simple checkbox in the settings allows users to choose which option they’d prefer.

          • Serinus@lemmy.world
            link
            fedilink
            arrow-up
            2
            ·
            1 year ago

            “just add a setting” is generally bad software design. If you have a million toggle switches, it makes it difficult to test the various combinations.

            Sometimes an option is useful enough that it’s worth adding to settings. I don’t think this is one of them. Just use middle click or Ctrl+click or back arrow.

        • JoBo@feddit.uk
          link
          fedilink
          arrow-up
          2
          arrow-down
          10
          ·
          1 year ago

          It’s overriding my browser preferences. That should not happen.

            • JoBo@feddit.uk
              link
              fedilink
              arrow-up
              1
              arrow-down
              3
              ·
              1 year ago

              I found a bunch in Firefox config settings. One was so extreme that on Kbin, refreshing the feed would open a new tab. In Lemmy, nope, didn’t work.

              • cley_faye@lemmy.world
                link
                fedilink
                arrow-up
                7
                arrow-down
                1
                ·
                1 year ago

                Calling BS on that. There is nothing in lemmy’s link that would force opening in the same tab. Proof:

                • there is nothing preventing middle-click/shift-click/context menu from actually working as intended
                • there is nothing on the a elements related to that, anyone can see it on every page
              • As far as I can tell, there is no Javascript override in the Lemmy code for links. It will follow standard browser behaviour for post links. Whatever Firefox config settings you’ve found don’t always seem to apply, it seems.

                In the main branch of lemmy-ui there is actually a setting to open links in new tabs (by explicitly setting target to _blank on anchors), but that’s not in any release version (yet). It’s likely thst the next version (be that 0.18.5 or 0.19) will contain this setting.

      • Deebster@lemmy.ml
        link
        fedilink
        arrow-up
        14
        arrow-down
        2
        ·
        1 year ago

        I think that forcing links to create new tabs world be a problem. Links working the default, normal way is a feature, not a bug.

        • JoBo@feddit.uk
          link
          fedilink
          arrow-up
          4
          arrow-down
          7
          ·
          1 year ago

          Links opening in new tabs is the default normal way. Most sites don’t send you off their site by default, for obvious reasons. And most feeds won’t lose your place in the feed by default, for equally obvious reasons.

      • cley_faye@lemmy.world
        link
        fedilink
        arrow-up
        8
        ·
        1 year ago

        Please tell me how to open a link with target=_blank in the same tab if I want to.

        Or, maybe you think that the problem should not exist because you think your opinion is everyone’s?

      • Kissaki@feddit.de
        link
        fedilink
        English
        arrow-up
        7
        ·
        edit-2
        1 year ago

        Everyone knows the various workarounds.

        You have no idea what “everyone” knows. Many - and I’m certain most - don’t.

        • JoBo@feddit.uk
          link
          fedilink
          arrow-up
          2
          arrow-down
          2
          ·
          1 year ago

          Mine doesn’t but I’ve found an option to switch three-finger click to middle mouse button. Thanks.

      • TheGreenGolem@lemm.ee
        link
        fedilink
        arrow-up
        5
        ·
        edit-2
        1 year ago

        Ctrl + Click

        But yeah, it’s odd.

        The worst is fucking Jira. Why on Earth would I want to navigate away from my ticketing system EVER.

      • Natanael@slrpnk.net
        link
        fedilink
        arrow-up
        4
        ·
        1 year ago

        Most laptops have gestures like triple finger tap on the mouse pad for simulated wheel click

        • JoBo@feddit.uk
          link
          fedilink
          arrow-up
          4
          arrow-down
          4
          ·
          edit-2
          1 year ago

          So now I need to buy a mouse and sit at a desk in order to use Lemmy?

          C’mon. No other site behaves like this. It needs to be fixed.

          • CrayonRosary@lemmy.world
            link
            fedilink
            arrow-up
            1
            ·
            edit-2
            1 year ago

            “To own a mouse, one must first buy a mouse.”

            • Carl Sagan

            Once you’ve crawled under that hurdle, you buy a hard mouse pad. Mine’s steel covered with a thin layer of plastic. Works great on the arm of a couch or just on a pillow.

            Now you can play first person shooters on the couch! Without the horrors of a controller.

            Navigating the web is easier. Everything is easier! It’s dreamy. Give it a try sometime.

            • JoBo@feddit.uk
              link
              fedilink
              arrow-up
              1
              arrow-down
              1
              ·
              1 year ago

              If I wanted a mouse, I would have a mouse. I do not want a mouse.

    • cley_faye@lemmy.world
      link
      fedilink
      arrow-up
      3
      arrow-down
      1
      ·
      1 year ago

      It does not. There is nothing on lemmy’s link to force link to open in the same tab. Your browser can do whatever it wants.

      Maybe your confusing the behavior that a lot of site decided to implement as default (open in new tab) with a browser setting.

      • treadful@lemmy.zip
        link
        fedilink
        English
        arrow-up
        4
        ·
        1 year ago

        Maybe your confusing the behavior that a lot of site decided to implement as default (open in new tab) with a browser setting.

        Try reading OP’s title and post body, then my reply again.

    • MonkderZweite@feddit.ch
      link
      fedilink
      arrow-up
      1
      arrow-down
      1
      ·
      1 year ago

      That they are allowed/capable to, is beyound me. That starts with font size and ends with viewport-width.

  • This feature was requested a while ago and the main Lemmy dev disagreed with it. I sort of agree (they’re just links, every browser has quick ways to open links in new tabs, there are alternative frontends that do it if you want to, etc.) but who knows if their position on the topic changed.

    You could also ask your friendly Lemmy server admins if it’s possible to add this patch to your server if upstream Lemmy doesn’t want to do it.

  • Zloubida@lemmy.world
    link
    fedilink
    English
    arrow-up
    32
    arrow-down
    1
    ·
    1 year ago

    Yeah, but no: blind and visually impaired people have troubles navigating the web because of these links that are opened in a new tab/window.

    It could be an option to activate, though.

    • rambaroo@lemmy.world
      link
      fedilink
      arrow-up
      8
      ·
      1 year ago

      Yeah, this is the real reason you’re not supposed to open external links in a new tab. It’s an accessibility issue.

    • Otter@lemmy.ca
      link
      fedilink
      English
      arrow-up
      32
      ·
      edit-2
      1 year ago

      There might even be discussions on it which you can vote on.

      Eventually it would be nice to have a toggle in the settings. Could keep the current behavior as the default and let users change it

      • Fonzie!@ttrpg.network
        link
        fedilink
        arrow-up
        1
        arrow-down
        1
        ·
        1 year ago

        No, because it’s not a bug.

        Please don’t clutter actual bug reports with feature requests or design discussions.

    • Synthead@lemmy.world
      link
      fedilink
      arrow-up
      5
      arrow-down
      2
      ·
      1 year ago

      I don’t really agree with this, though. I’m all about control or what have you, but I don’t feel that I’m in less control if I cannot leave Lemmy when clicking a link. I can’t see any flow where this is expected behavior other than the principle of not setting a target.

    • JoBo@feddit.uk
      link
      fedilink
      arrow-up
      1
      arrow-down
      5
      ·
      1 year ago

      Lemmy overrides that setting. It works everywhere but here and it is irritating as hell.

  • mattomattic@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    20
    arrow-down
    3
    ·
    1 year ago

    I really don’t mind doing right-click-new-tab. What I don’t like is, when you click back it often doesn’t take you back to where you were before. So, totally agree with the request as it would leave you at your place.

      • Flying Squid@lemmy.world
        link
        fedilink
        arrow-up
        2
        arrow-down
        1
        ·
        edit-2
        1 year ago

        Middle click works on a Mac too if you have a pointing device with one. My Logitech trackball does, but you have to push down the scroll wheel, so I never think about it.

        • Fonzie!@ttrpg.network
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          Most mice have a middle click, it’s pushing down the scroll wheel, this works on Windows, macOS and (most) Linuxes alike.

  • Kissaki@feddit.de
    link
    fedilink
    English
    arrow-up
    15
    ·
    1 year ago

    If you force tabs to open in a new tab/window, how do you open it in the same tab/window?

    Ultimately, it is about user control and possibly accessibility.

    Depending on your input device you can open a link in a new tab directly through

    • Middle mouse click
    • Ctrl + mouse click
    • Ctrl + Enter

    The alternative or fallback is to use the context menu like you say.

    Who says they should categorically and always open in new tabs though? In what contexts? On what kind of environment behavior does that depend? Does it assume a standard single open, auto focus, close, get back to the previous page? What makes a navigate back worse?

    If you want a general, categorical solution for your preference, as long as Lemmy does not provide a setting for it, a simple browser addon could automatically adjust all links on a websites pages, or your browser may offer it.

  • TheBananaKing@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    I wrote a userscript for old.lemmy.world to make the header floaty and to force links into a new tab.

    It’s not completely perfect, but it’s increased my QOL and I’d hate to go back.

    It won’t work on the default site, of course.

    Let me know if you want it, it’s short enough to just paste in a reply.

  • Dem Bosain@midwest.social
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    1 year ago

    I have a greasemonkey script that does this on instances that support the “old” theme. I’m having trouble getting it to work on the default theme because target=“_blank” seems to work intermittently. Or I could be doing something wrong, I haven’t looked into it too deeply.