How to open a link in a new window

Source: Internet
Author: User
If the title is changed to "User Experience", I feel a little bigger. After all, I am not an expert in this field. Here I just want to talk about my feelings. I still remember learning how to create a web page very early. At that time, I didn't know how to open the link from a new window, nor did I care about it, because the web page is just a publicity... if the title is changed to "User Experience", I feel a little bigger. After all, I am not an expert in this field. Here I just want to talk about my feelings.

I still remember learning how to create a web page very early. At that time, I didn't know how to open the link from a new window, nor did I care about it, because the web page only serves as a publicity profile, after that, there were more links to this kind of thing. Yes, there were no browsers with Multiple labels and tabs at that time, and we all used window browsers such as IE6. At that time, big family became a habit, it is to open a page, wait until the browsing ends and subconsciously close the browsing window, do not know this page's previous page also needs, or the website author does not want the visitor to break away from his website after clicking an external link, because the webmaster thinks that he or she still has a better website ...... Front-end UI framework sharing

Because of these reasons, the majority of webmasters have adopted the new window opening mode of external links. The new window opening is nothing more than a JavaScript window. the open method or target = "_ blank" method, because the latter does not require script support, it actually uses more. This seems to have been perfect. Is it true? These websites continue to cultivate the habit of blindly pressing × to close the window. Maybe they should try a new way, that is, pressing Shift and clicking the left mouse button to open the page.

One day, the new standard XHTML 1.0 emerged, and the majority of webmasters found that the original target = "_ blank" could not pass the standard, so they began to think: "What did we do wrong? ". What did we do wrong? You can refer to this Article "_ blank new window does not meet the standards?" Everyone should know what is going on. opening a new window without restrictions will deprive users of their right to choose whether to open the original window or new window, we must transform the design from self-centered to user-centered for user consideration. But then again, the new window opening mode in China is quite in line with national conditions, everyone is used to it by default. When you give the right to the user, the user suddenly becomes unaware of the measures, and may even blame your design. You obviously think for the user, however, users do not appreciate the situation.

Do we need to open a new window? Is there a good way? At least I think the MSDN practice is worth learning. MSDN places a small icon next to an external link to indicate that this link is an external link, but it is actually opened in this window.

Why don't we take advantage of this small icon? That is to say, click the link to open this window, and click the small icon next to it to open a new window. It seems that this problem has been properly solved here, this solution has been available for a long time and is also a good solution I think. Of course, if you have any better solutions, you can discuss it with me. Front-end UI framework sharing

Add the JavaScript code that is automatically recognized and added with the external link icon:

(Function () {var window = this, undefined; function addListener (element, e, fn) {if (element. addEventListener) {element. addEventListener (e, fn, false);} else {element. attachEvent ("on" + e, fn) ;}} var outlinks = {protocol:/^ (? : Http | https | ftp | mms ):(? : // | \)/I, local_url: location. hostname, // get the local domain name icon: 'outlink.png ', // change it to your own icon path set: function (obj, list) {for (var I = 0; I Reply content:

If the title is changed to "User Experience", I feel a little bigger. After all, I am not an expert in this field. Here I just want to talk about my feelings.

I still remember learning how to create a web page very early. At that time, I didn't know how to open the link from a new window, nor did I care about it, because the web page only serves as a publicity profile, after that, there were more links to this kind of thing. Yes, there were no browsers with Multiple labels and tabs at that time, and we all used window browsers such as IE6. At that time, big family became a habit, it is to open a page, wait until the browsing ends and subconsciously close the browsing window, do not know this page's previous page also needs, or the website author does not want the visitor to break away from his website after clicking an external link, because the webmaster thinks that he or she still has a better website ...... Front-end UI framework sharing

Because of these reasons, the majority of webmasters have adopted the new window opening mode of external links. The new window opening is nothing more than a JavaScript window. the open method or target = "_ blank" method, because the latter does not require script support, it actually uses more. This seems to have been perfect. Is it true? These websites continue to cultivate the habit of blindly pressing × to close the window. Maybe they should try a new way, that is, pressing Shift and clicking the left mouse button to open the page.

One day, the new standard XHTML 1.0 emerged, and the majority of webmasters found that the original target = "_ blank" could not pass the standard, so they began to think: "What did we do wrong? ". What did we do wrong? You can refer to this Article "_ blank new window does not meet the standards?" Everyone should know what is going on. opening a new window without restrictions will deprive users of their right to choose whether to open the original window or new window, we must transform the design from self-centered to user-centered for user consideration. But then again, the new window opening mode in China is quite in line with national conditions, everyone is used to it by default. When you give the right to the user, the user suddenly becomes unaware of the measures, and may even blame your design. You obviously think for the user, however, users do not appreciate the situation.

Do we need to open a new window? Is there a good way? At least I think the MSDN practice is worth learning. MSDN places a small icon next to an external link to indicate that this link is an external link, but it is actually opened in this window.

Why don't we take advantage of this small icon? That is to say, click the link to open this window, and click the small icon next to it to open a new window. It seems that this problem has been properly solved here, this solution has been available for a long time and is also a good solution I think. Of course, if you have any better solutions, you can discuss it with me. Front-end UI framework sharing

Add the JavaScript code that is automatically recognized and added with the external link icon:

(Function () {var window = this, undefined; function addListener (element, e, fn) {if (element. addEventListener) {element. addEventListener (e, fn, false);} else {element. attachEvent ("on" + e, fn) ;}} var outlinks = {protocol:/^ (? : Http | https | ftp | mms ):(? : // | \)/I, local_url: location. hostname, // get the local domain name icon: 'outlink.png ', // change it to your own icon path set: function (obj, list) {for (var I = 0; I

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.