Skip to content

Preference to open external links in new tabs #37

@PortableProgrammer

Description

@PortableProgrammer

Proposal

Add a user preference that makes external links (post URLs to non-reddit/non-lurker domains, oembed iframes, expanded ExtLinks) open in a new tab via target="_blank" rel="noopener noreferrer". Internal navigation (subreddit pages, comment threads, dashboard) stays in the same tab.

Definition of "external"

Any URL whose host is not the lurker host itself and not reddit.com / redd.it (those get rewritten to relative URLs by #34).

Schema

New column pref_openExternalInNewTab (boolean, default 0).

Touches

  • DB migration in src/db.js
  • prefToColumn map in src/routes/index.js:566-571
  • get_user_prefs helper at src/routes/index.js:952
  • Dashboard checkbox in src/views/dashboard.pug
  • Conditional target attribute on external anchors in post.pug, comment.pug, index.pug — easiest via a pug mixin or utility helper

Acceptance

With the preference enabled, clicking an external post link opens a new tab; clicking a subreddit name or comment thread stays in the same tab.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions