Sometimes we want to implement such a function: click a link. If the link has been opened in the browser, refresh the opened link window; if the link has not been opened, open the link page in a new window. This is a very good experience enhancement feature that can effectively avoid opening duplicate and redundant pages in browser tabs. The key is how to achieve it? Use the target attribute of the a tag: Both the a link element and the form element have an attribute called target. The supported values include the following:
In fact, target has a hidden feature, which is that it can be specified as a specific URL address or any custom name. For example: <a href="http://www.baidu.com" target="http://www.baidu.com">Blank page</a> At this time, if the browser already has a tab with the address blank.html, clicking the above link will not open a new window, but will directly refresh the already opened blank.html; if there is no tab with the address blank.html in the browser, the behavior of the target attribute is similar to '_blank'. In other words, if we want to achieve the requirement of automatic refresh of link address and opening of new window, we just need to set the target attribute value of link element and form element to the target URL address value. Therefore, if you want to use one tab for all search results pages, you need to use other methods. It is very simple. Just specify the same value, for example: <a href="blank.html?s=1" target="_search">blank page?s=1</a> <a href="blank.html?s=2" target="_search">blank page?s=2</a> As you can see, Summarize To achieve the function of automatic refresh of the a element href link or opening in a new window, you only need to set the target attribute value to the same as the href attribute value. This feature is supported by IE, Firefox, and Chrome, so you can use it with confidence. This is the end of this article about how to implement automatic refresh or new window opening of URL links of a element href in html. For more relevant content about how to implement automatic refresh or new window opening of URL links in html, please search previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! |
>>: CSS complete parallax scrolling effect
1. Check the maximum number of open files in the ...
Table of contents Angular accomplish Calling orde...
apt install CMake sudo apt install cmake This met...
In order to avoid repeatedly entering the Docker ...
There are some differences between filter and bac...
I won't go into details about how important b...
Scary, isn't it! Translation in the picture: ...
Environmental preparation: Deploy lnmp on a host ...
User table, ID number must be unique, mobile phon...
<br />Looking at this title, you may find it...
Abstract: This article will demonstrate how to se...
background Recently, some friends who are new to ...
Table of contents VMware BurpSuite 1. Virtual mac...
This is a very important topic, not only for Linu...
HTML is a hybrid language used for publishing on ...