Open in a new html page. Open the links in a new browser tab. Why is target="_blank" bad?

Hello. It’s such an unpleasant glitch, to be honest, when . Once it happened to me on Windows XP, back when there was no seven. You go to several folders and get several windows.

To be honest, I don’t even know what causes this problem, or is it some kind of virus that is so harmful, but I heard somewhere that it’s Internet Explorer it's so funny. But this is not so important, the main thing is how to fix this error, and I will write about this below.

I will show an example of solving this problem in the operating room. Windows system 7. Yes, we still need to find out which Windows 7 you have installed, 32-bit or 64-bit.

To do this, click on the “My Computer” shortcut right click mouse and select “Properties”.

A window will open in which we look for “System type” and opposite it will indicate which Windows 7 you have installed. Like this:

As you can see, I have 32-bit, by the way, which one is better I wrote. Remember which one you have, we will need it later.

Now click “Start”, go to “All Programs”, “Accessories” and launch the “Command Prompt” program.

Here we will need to write two commands in turn, but the commands for 32-bit and 64-bit are different. So, remember what Windows 7 you have and select the necessary commands for yourself.

For 32-bit:

regsvr32 “%SystemRoot%System32actxprxy.dll”
regsvr32 “%ProgramFiles%Internet Explorerieproxy.dll”

For 64-bit:

regsvr32 “%WinDir%SysWOW64actxprxy.dll”
regsvr32 “%ProgramFiles(x86)%Internet Explorerieproxy.dll”

Select one line and copy it using the combination Ctrl+V, or right click and “Copy”. Then we go to Command line(which we have already launched) and paste the code by right-clicking and selecting “Insert”.

Then we confirm the execution of the command with the “Enter” button. And we do the same with the second line.

Reboot the computer.

And one more option

Go to “My Computer”, and at the top left click on “Organize”, and then “Folder and Search Options”. A window will open in which you need to check that in the “Folder Menu” area the checkbox is set to “Open a folder in the same window”. If you have the option “Open each folder in a new window” checked, then check the first item and click “Ok”.

The problem with opening folders should be resolved, but if not, then write in the comments. We'll figure out:).

Friends, but if you have problems more serious than problems with opening folders, for example, you have problems with telephone communication in your company, I advise you to pay attention to the number 8 800, which will help your clients reach you at any time and with pleasure.

Also on the site:

What if each folder opens in a new window?

updated: January 11, 2015 by: admin

The article indicates the basic principles of using the target="_blank" attribute, and also suggests an alternative to using this attribute, in which the code will remain valid. Quite often there is such a practice when, when you click on a link, you go to landing page carried out in a new browser tab. This technique is very often used when specifying the developer of a web resource or answer to a request in search engine

. This technique is achieved through the use of the target attribute of the tag. Below is a code example:

< a href= "#" target= "_blank" >

HTML In the current understanding of modern competent layout and user interaction with the functionality of the resource, it is generally accepted that the visitor must determine for himself exactly how he will follow the link. This same opinion is supported by experienced and famous web developers. Also use of this attribute disrupts the functionality of the browser's "Back" button - this also counts negative effect

attribute. The listed factors may cause indignation of the site visitor. Some explain the use of the target attribute by the fact that when using it, even if the user found what he was looking for on another resource (to which the link was sent), after closing the newly opened tab, he will return to the previous site. This supposedly increases the likelihood of converting a casual visitor into a regular user. This statement is wrong! You can win the user’s constant attention only with interesting and quality content

. It is in vain that information is considered one of the most valuable resources.

Additionally, according to the XHTML 1.0 Strict specification, the use of the target attribute is illegal. Otherwise, the code will not be considered valid. And the validator itself will display the following message:

Opening a link in a new tab using JavaScript

The principle of organizing such a process is based on the onclick event. In the value of this event, a function will be written to open a new browser tab - window.open() , as well as a blocker that will cancel the transition to required address in the current window - return false . In code, all these actions will look like this:

< a href= "#" onclick= "window.open(this.href); return false" >Link that opens in a new tab

To verify the effectiveness of the proposed method, you can click on this link, it will open in a new window.

After we are convinced of the effectiveness of the method, we check the validity of the code. The validator issues a green message, which indicates that our code is flawless.

At first glance, we have achieved a rational solution to the problem, but upon detailed testing of the method, it turned out that if the browser has a pop-up blocker installed, the method will stop working. Instead of clicking on the link, a pop-up blocking message will appear.

Modification of js code for a successful transition under any conditions

The above-mentioned function is designed to relieve the user of excess advertising on the Internet. All modern browsers have such an ability in their arsenal, in addition, some of them can block on different levels. For example, everything Opera versions, starting from the 9th, they have the ability to block only marked windows or all of them.

Although there are probably very few users who install pop-up blockers in their browsers, they still exist. And we must take everything into account possible options For normal functioning site. Let me remind you that if there is a block, the link in our js code will stop working.

Then what choice should you make: either the code is not valid, or the links are not always working? Neither option suits us. Alternative solution came when testing a link with the target attribute and pop-up blocker enabled. Under the given conditions, the link opened, but only in its own window. This means we need to modify our js code so that when blocked, the link will work in the current window. This is implemented as follows:

< a href= "#" onclick= "return !window.open(this.href)" >Link that opens in a new tab

The principle of operation of the method has remained virtually unchanged, but the form of interpretation of actions has changed. In the new code, the window.open() function evaluates to true if the lock is not installed, but if it is present, the function evaluates to false . Speaking in Russian, when you set the appropriate settings in the browser, the link will open in the current session, otherwise - in a new tab.

Examination modified solution for a link to the main blog.

conclusions

Based on the information presented above, we can conclude that the most rational way to force links to open in new tabs is to use the latter method, which is based on JavaScript code.

However, at the same time, such things should be used carefully, as this imposes certain actions user and limits his freedom of decision-making. This is considered bad manners.


.

Internet Explorer Mozilla Firefox Working with Tabs
V Google browser Chrome






with tabs.

Find all full information about working with tabs you can in your Google Chrome.

Browser problem: all links open in a new tab

To do this, open your browser and simply click function key F1 on your keyboard. Or click the icon wrench, and maybe an icon like mine, instead of a wrench, at the end address bar browser. And select Help at the bottom of the tab that opens. A new tab will open with a Tabs and Windows link in the center. Click and all the Headings associated with the tabs will open on the right.

Safari Opera

When you surf the Internet, modern browsers always allow you to open a page via a link in a new window or tab. This is often very convenient - you see an interesting link, but do not look up from the text you are reading, but open the link in a new window or tab to return when you are done with it open in this moment. I always wanted such an opportunity to exist in Windows Explorer— right-click on the folder — and there is an option there: “open in a new window.”

It’s easy enough to add such an option by going into the properties of Explorer, but don’t do this on every computer you visit! It is much better to automate the process using reg file. This is the second goal of this article - to continue the topic of the registry and show how it can be edited not only by hand.

In this article I will provide the code for a file that adds an option to the context menu; In addition, this file can be downloaded. If you have interesting examples registry files, send them to me in the comments!

Note: I apologize to those who were waiting for an article about anonymity. I don't have time. I'm putting it out from stock.

So, the registry.

How to make links open in a new window or tab

If you have already run regedit, then you can experiment with exporting the entire registry or part of it. To do this, you need to stand on the registry branch, go to the file-export menu and select where you want to upload. The result will be a file with the extension reg, double tap which will be used to restore the registry - reverse loading. But you can create such a file yourself, which is what we will do now. Create text file and write down the following content inside:

@="Open in new window"

@="C:\\WINDOWS\\explorer.exe \"%1\""

Now the file needs to be renamed - change its extension to reg. How to do it? Exactly the same way you rename other files, only you first need to display the file extensions.

Double-click on such a file, agree to make changes to the registry - and voila, the context menu has been changed - when you right-click on the folder, the "open in new window" option appears. If you don't want to create, edit and rename the file, you can download it from my website.

But my site will make such a file home page in Internet Explorer

Windows Registry Editor Version 5.00

"Start Page" = "https://it.sander.su/"

You have good examples files for editing the registry? Send it! By the way, let me remind you of my old post about Windows script host - there are examples there comic programs in the language built into Windows.

comments powered by

How to open a link in a new window?
How to change
tab settings

in browsers
Browsers are initially configured differently to open new pages. For example, Safari is configured to open new pages in a new window. And Mozilla Firefox opens new pages in new tabs on the Tab Bar, but in addition we have the ability to open new windows.

You can change the settings yourself.

Internet Explorer Change tab settings in Explorer is available in the Internet Options section. Click on the gear icon at the top right of the browser panel. Select Internet Options, then select the General tab and at the bottom, in the Tabs line, click on Options. In the center below the line When opening a new tab, open: select the desired way to open tabs in the black triangle.

Mozilla Firefox

To change tab settings in Mozilla browser Firefox, click the Tools button in the toolbar. At the bottom, click Settings. At the very top of the new window, click Tabs. And here you can either check the boxes or uncheck them in the way you want to open new tabs.

Working with Tabs
in Google Chrome browser

In the last Google versions I didn't find Chrome
ability to change settings for tabs.
Probably this is very convenient and smart browser and no need to change settings. Because Google Chrome offers users many tabbed options.
Very easy to open new tab and new
window, even through hotkeys.
Need to open the same web page in multiple tabs
There is an option to Duplicate a tab. There is an opportunity to work
in incognito mode ( hidden viewing). You can move the desired one
tab in a separate window. And many more job opportunities
with tabs.

You can find all the complete information about working with tabs in your Google Chrome. To do this, open your browser and simply press the F1 function key on your keyboard. Or click the wrench icon, or maybe an icon like mine, instead of a wrench, at the end of the browser's address bar. And select Help at the bottom of the tab that opens. A new tab will open with a Tabs and Windows link in the center. Click and all the Headings associated with the tabs will open on the right.

Safari

To change settings for tabs in Safari browser Click the gear icon on the right side of the browser panel. In the new tab, select Settings, and in the next window, select Tabs. And here in the line Open pages in tabs, not in windows: select the option you need.

Opera

IN Opera browser To change tab settings, click the Tools button on the panel. Select at the bottom of the new tab General settings. And in this tab, click on the Advanced panel and then the Tab Settings button. A window will open Additional settings tabs. Check the box next to the way you want to open tabs and click OK at the bottom.

Go to the main page of the site

One of the site visitors asked how to open a link in a new HTML window. In this article I will answer this question.

What you will need

The visitor did not specify which editor he uses, so we will assume that it works directly in HTML. But this does not mean that you cannot follow these instructions if you use any visual editor. You'll just need to access the page layout. Most editors and blogging platforms allow you to manually edit the HTML code.

For example, if you are working in Expression Web, you can edit the page code by switching to Code mode.

How to set links to open in a new tab or new browser window

thesitewizard.com

Change it to look like this:

thesitewizard.com

Now, when users click on this link, it will open in a new window or tab (depending on what browser they are using and how it is configured).

Please note that if you are using a DOCTYPE with strict XHTML 1.0 or 1.1 syntax, you will not be able to use the above code and have the page validated at the same time. But I suspect that no one uses these standards. The "transitional" versions of these standards for opening in a new HTML window are fine for us, and they also support the target attribute.

If you're working in Expression Web, Dreamweaver, BlueGriffon, or KompoZer, click on the link you want to edit, go into HTML edit mode, and add the target="_blank" attribute.

This method doesn't have many advantages.

Many new webmasters think that by opening links in a new window, users are less likely to leave the site. This is fundamentally wrong. If someone clicks on a link and then wants to return to your site, they will simply click the "Back" button. Even the least technically savvy people will learn about this function immediately after getting acquainted with the Internet. Advanced users also know that you can use the “Open link in a new tab” (or “Open link in a new window”) option.

By creating links that open in a new window, you prevent users from returning to your site. It may seem that they will easily return to the first window with your site. My experience is that this is not the case - it confuses people broken button"Back ". They don't even suspect that there is a new tab or a new window in front of them. When they are unable to quickly return to previous page, they simply give up and move on to other resources.

Experienced users fare no better. They are very annoyed by your site’s “habit” of opening new windows without permission. That's why they experienced users- if they wanted to open a new tab, they would do it themselves, and they don’t like it at all that they do it without their consent. It's even worse if all your links open in a new window.

The site becomes vulnerable to phishing attacks

If you apply HTML button open in a new window using target="_blank" , the site to which the link leads gets access to the window/tab with your page and can replace its content.

This will not only not keep users on the site (if you opened new tabs for this purpose), but it will also endanger visitors. For example, if you have a user login page, the site located on the link can replace it with a copy of yours, but at the same time collecting user logins and passwords. This type of attack is called “phishing”.

And this is not a theoretical vulnerability. Department specialists Google security noted a “significant number of reports” about such interception of tabs for the purpose of introducing malicious software.

For those who are interested - technical details. The site opened in a new window accesses your page through the window.opener object in JavaScript. This is a read/write object that can be manipulated. Among other things, you can change the window.opener.location property and force the browser to go to the new address to open the image in a new HTML window.

Some browsers allow you to prevent this behavior by adding a rel="noopener noreferrer" attribute to the link. The example given at the beginning of the article would look like this:

thesitewizard.com

In theory, both rel="noopener" and rel="noreferrer" should be enough to protect against such an attack when opening the page in a new HTML window. In this case, it is more correct to use the rel=”noopener” attribute, since rel=”noreferrer” has a side effect - the browser will not transmit the URL of the request source to the site. But at the moment, not all browsers support the rel="noopener" attribute. Likewise, rel="noreferrer" is not supported by some browsers. Therefore, if you want to protect users as much as possible more browsers will probably have to use both attributes.

However, this technique only works on current Chrome versions, Firefox and Safari. Internet Explorer this function does not support, although I quickly checked version 11 of IE, and it seems to be protected from such an attack with the default security settings. About the browser Microsoft Edge I can’t say for sure.

In other words, the method described above cannot be called one hundred percent protection. The best way To avoid this problem - use normal links without the target="_blank" attribute.

Conclusion

A general recommendation is to avoid opening tabs in a new HTML window if possible. Of course, in some cases this cannot be avoided. In this situation, you can warn site visitors that “link opens in a new window”. This won't help the average user much and won't protect them from phishing attacks through your site, but at least it won't annoy more experienced users.

The expression open links in new window in this article means that links will open in a new tab or window, depending on your browser settings. In any case, it is assumed that the page from which the link was clicked will remain open.

Why might this be needed? The visitor is currently on your site, and there is an external link in the article or on the site page. If this link is of interest to the visitor in some way, then after clicking on such an external link he will be taken to another site.

On another site, he may open several more pages and after that it will be difficult for him to get to your site again. He didn’t finish reading your article, and not every computer user will immediately understand how to get to your site again, because people different preparation and it is not always clear to beginners what to do in this case.

In the browser, you can click on the back button, but the visitor could close the window on another site altogether, but he wanted to finish reading your article, and not the article that he accidentally landed on external link.

You can open a link in a new browser tab by manually inserting the “target” attribute with the tag value “_blank” into each such link . In HTML it will look like this - target=”_blank”. But there can be a lot of such links, and you won’t always remember which external links have not yet had this attribute inserted.

When adding new links and images in an article, in the WordPress admin panel, in the text editor, there are corresponding items, the activation of which allows you to open the added links and images in a new window.

There are several ways to make links open in a new window. In this article I will describe only those methods that worked on my site.

Some methods did not work correctly on my site in the previous template, so I will not talk about them. In particular, it was displayed incorrectly home page in a way that requires connection JavaScript libraries- jQuery. Additionally, this method would not work if JavaScript was disabled.

How to open a link in a new window

In order to open absolutely all links on the site in new windows or tabs, you will need to insert special code to the file “Header (header.php)”.

To insert this code you need to enter " WordPress Admin Panel» => « Appearance" => "Editor" => "Header (header.php)".

In the file “Header (header.php)” between the and tags you need to insert the following code right before the closing tag:

This setting for opening pages in a new window or tab does not seem very convenient to me, because this opens many windows or tabs in the browser. But, I know that for some, on the contrary, it will be convenient to be able to open external and internal links on their site in this way.

Target Blank In Posts And Comments Plugin

The Target Blank In Posts And Comments plugin helps you open links in comments and posts in a new window without affecting other internal links on the site.

You can download the Target Blank In Posts And Comments plugin from here.

This plugin hasn't been updated for a long time, but it works well on latest version WordPress engine, and copes with his duties perfectly. It also worked on my site for some time.

To install the Target Blank In Posts And Comments plugin, you will need to log in to the “WordPress Admin Panel” => “Plugins” => “Add New” => “Install Plugins” => “Upload”. After downloading, the plugin needs to be installed and activated.

The Target Blank In Posts And Comments plugin does not require any settings and starts working immediately after its activation.

Using this plugin will allow you to return visitors to your site who clicked on an external link from your site. After all, it often happens that a visitor has been looking for a long time necessary information, and then suddenly clicked on a link that interested him from a comment or article, then went somewhere else, and thus the visitor often cannot find the site from which he originally came.

The Target Blank In Posts And Comments plugin does its job well, allowing you to retain and return visitors to your site.

Opening a comment link in a new window

If you need to open links with comments without the help of a plugin, then this can be done after changing the corresponding code. Changes will need to be made in the code of the “comment-template.php” file, which is located in the “wp-includes” folder.

To do this, you will need to connect to your site via FTP connection using programs such as FileZilla or Total Commander. This can also be done using file manager, which is located in the Control Panel of your hosting.

The file “comment-template.php” is located approximately along this path - domains/name of your site/public_htlm/wp-includes/comment-template.php.

Attention! Before changing the “comment-template.php” file, you must make a copy of it. In case of problems, after changing the file code, your site may stop working normal mode. In this case, you will have to replace the file you changed with the saved one. original copy this file.

Happened to me similar case, and I had to rollback the site to working condition by using technical support my hosting. I didn't save a copy original file, made incorrect changes to the file code, and after that my site stopped being displayed on the Internet for some time.

This would not have happened if I had made a copy of the file before changing it, because I would have immediately replaced the broken one with a working one.

You will need to copy the “comment-template.php” file to your computer and save it. You need to make a copy of the saved file and make changes in the file code by opening it using text Notepad editor++. You can open the file in Notepad, but it will be very difficult to find in Notepad required lines code to change it.

Next you should add the line starting with $return = ”