View Full Version : HTML Image Link In The Same Window/Tab

Jun 17th, 2010, 10:51 PM
Hey, I have a website and I have Images that link to different pages within the website. This is a sample of the code that I use:

<a href="Sample.html" target="_blank"><IMG SRC="Sample.jpg"></a>

Now when someone clicks on the image, it takes them to the new link, however, it opens up a new window/tab when it does that (I use the Google Chrome browser). I want it to open in the same window/tab instead of opening in a new one. How can I change the code to do that?

Jun 17th, 2010, 10:54 PM
Oh, and after taking the target="_blank" parts out, on my computer it will open in the same window/tab, but when I updated my website without that code, it still opened in a new window/tab.

Major Payne
Jun 19th, 2010, 03:42 AM
People's browsers have options as to how links on web pages open when clicked. Check whether you have your browser set to open a new tab/window when you click on a web page link. Also, people can decide to choose whether to open links in a new tab/window by right-click the link and making a selection from the Context Menu.

I do not recommend using the target="" (http://www.w3schools.com/tags/att_a_target.asp)attribute unless you are using the correct document type that allows or needs it.