Comments (7)
My argument here is sort of hypocritical since this is currently an option in the link panel, but I'll say it anyway. There's a lot of debate about target="_blank"
and I was reluctant to even include it in the editor for links (still debating if it should be left in or removed).
I'm reluctant to add this for a few reasons:
- It's bad UX to mess with the browser's default behavior (although there are some uses for it)
- It could introduce security risks
- It's not semantic
- Perhaps most importantly, users shouldn't have to think about these things
Decisions like this need to be made with more thought than most users will care to give. Letting them check boxes arbitrarily leads to inconsistent results and poor UX for their visitors.
If the designer chooses that this is the preferred behavior for the website, the recommended approach is to use a script to accomplish it. For example, here's a vanilla JS snippet for opening external links in a new tab/window (source):
function externalLinks() {
for(var c = document.getElementsByTagName("a"), a = 0;a < c.length;a++) {
var b = c[a];
b.getAttribute("href") && b.hostname !== location.hostname && (b.target = "_blank")
}
}
This actually provides more flexibility than a checkbox in the UI, since they can decide if they want to target external links, certain domains, certain media types, or even individual pages. Of course, the flexibility goes to the designer, not the user — but we all know users tend to get creative when they have too much control. 😆
from postleaf.
In fact, now that I've actually outlined why target="blank"
is such a bad idea, it's more obvious that it needs to be removed from the link panel before it becomes a breaking change in 1.0. 😕
from postleaf.
I don't know. I think a lot of users will want this feature.
Perhaps an option in the .env to enable this feature for more advanced users...or those who really want it?
If plugins become a thing in Postleaf people are just going to implement this themselves anyways at some point.
At least this way you have the opportunity to show a message of reasons perhaps not to do it. Teach people rather than just restrict them.
from postleaf.
I just know when I'm reading articles or documentation and they link to another site or another page of documentation for further reading and it doesn't open a new tab I get really annoyed because I lose where I was. (I'm a 100 tabs open at once kinda guy)
from postleaf.
If not the target="blank"
attribute then at least the ability to add additional classes or data-attributes so people can target links with JS as they want.
from postleaf.
Teach people rather than just restrict them.
The people that need to be taught about things like this are web designers who don't know any better despite that being their job. End users don't care and will misuse things like this because they want something a certain way, and that negatively effects every visitor to their site.
I know I'm very opinionated and often anal about certain things. I believe the web designer should decide how things look, feel, and behave. These are critical design decisions, not ones that most users are capable of making without compromising their visitors' UX.
I just know when I'm reading articles or documentation and they link to another site or another page of documentation for further reading and it doesn't open a new tab I get really annoyed because I lose where I was.
True. On the other hand, I religiously use CMD+click to open links in a new window. When I expect a link to open on the same page and it doesn't, I too get annoyed. 🤷♂️
If not the target="blank" attribute then at least additional classes or data-attributes so people can target links with JS as they want.
Designers can target links with infinite flexibility using JavaScript, but this forces more thought and that's a good thing. It changes one's thinking from "I want this random link to behave differently for whatever reason" to "what makes a link unique in such a way that it should be opened in a new window?"
And that leads to a consistent design solution that end users don't ever have to think about 😄
from postleaf.
I've brain-dumped even more into a blog post since I know a lot of people will ask about this.
This is the type of decision that separates Postleaf from every other platform: the attention to detail, the focus on users and visitors, and the ability for designers to make decisions they're trained to make.
Lots of emotions will be stirred, I'm sure: postleaf.org/dont-open-links-in-a-new-window
from postleaf.
Related Issues (20)
- Unable to upload the images from admin panel HOT 3
- maxWidth for dynamic images // feature request HOT 1
- Security: brute force attack HOT 5
- getPosts Helper: sortBy not working HOT 8
- Some helpers do not support {:else} as documented HOT 4
- Postleaf could not be installed with Node.js 10.13.0 HOT 2
- NPM reports hundreds of vulnerabilities HOT 5
- Passing data to templates HOT 4
- Meta russian language HOT 4
- NPM install fails on sqlite3/microtime/node-gyp on ubuntu 64 bit on Raspberry Pi (arm)
- Application Error when navigating to Admin/Settings for New Install HOT 3
- MongoDB support HOT 1
- React for the dashboard HOT 1
- Install to a subfolder HOT 1
- Still in active development? HOT 1
- When editing an existing post, errors in the slug do not appear but you get "can not save the changes now" HOT 1
- HTML code block HOT 1
- Multi-Language HOT 1
- image upload err not processing images HOT 3
- Add Portuguese (Brazil) translation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postleaf.