Home > Web Front-end > JS Tutorial > A browser extension called \'Open New Tab For Developers\'

A browser extension called \'Open New Tab For Developers\'

WBOY
Release: 2024-09-06 13:00:25
Original
1030 people have browsed it

A browser extension called

As a developer, I often browse websites like Medium.com and Hacker News, but the links on these sites open in the same tab. After reading an article, I have to navigate back to the main site, which negatively impacts the user experience. Opening links in a new tab would be much better.

Therefore, I created a browser plugin called "Open New Tab."

Why did I have to write a new plugin? Because I searched for and used some existing plugins, but they mostly implemented a general logic. This general logic is simple and indeed works for most websites. However, it is not enough; merely writing general logic does not work for some specific websites. The functionality of this kind of plugin is quite similar to ad-blocking plugins, which need to handle the specific DOM structure of particular websites.

Take Medium, for example. Its tag's href attribute is not a complete URL but a strange path string. The complete URL is actually in the data-href attribute of an ancestor element. So for this site, the better approach is to get the complete URL and then open it in a new tab.

Therefore, the feature of this plugin is that, while it meets the need to open links in new tabs for all regular websites like Google, it also provides special handling for websites that developers frequently visit, such as Medium and Hacker News.

So, a more fitting name for this plugin would actually be: "Open New Tab For Developers."

tutor:https://www.bilibili.com/video/BV1hrpMe4E6x/
GitHub:https://github.com/cunzaizhuyi/open-new-tab-extension

The above is the detailed content of A browser extension called \'Open New Tab For Developers\'. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template