Magento Product page open in new tab Target Blank

Magento Product page open in new tab Target Blank

September 25, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento Product page open in new tab Target Blank

Opening Magento Product Pages in New Tabs

Opening your Magento product pages in new tabs can enhance user experience by keeping them on your site while exploring different products. Here’s how you can achieve this using simple HTML markup.

Understanding the Issue

By default, clicking a link on a website opens it in the same browser tab as the referring page. This is usually what we want for navigation within our own site. However, when linking to an internal product page, it might be beneficial to open that page in a new tab.

The Solution: Using Target Attributes

The key lies in adding the target="_blank" attribute to your anchor (<a>) tags while linking to product pages.

How to Implement It

Let’s say you have a category page where you display links to products. You can modify your code as follows:

<div class="category-products">
    <?php foreach ($this->getProductCollection() as $_product): ?>
        <div class="item">
            <a href="<?php echo $_product->getProductUrl() ?>" target="_blank">
                <img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail'); ?>" alt="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'thumbnail')) ?>"/>
                <h2 class="product-name"><?php echo $this->htmlEscape($_product->getName()) ?></h2>
                <?php if ($_product->getShortDescription()): ?>
                    <div class="description">
                        <?php echo $_product->getShortDescription() ?>
                    </div>
                <?php endif; ?>
            </a>
        </div>
    <?php endforeach; ?>
</div>

In this example, the target="_blank" attribute is added inside the anchor tags linking to each product. When a user clicks these links, the Magento product page will open in a new browser tab while keeping them on your website.

Best Practices and Considerations

  1. Use this technique judiciously: Opening too many tabs at once can overwhelm users with too many windows.
  2. Ensure your site is mobile-friendly: Tabs are less useful on mobile devices, so test your solution on all screen sizes.
  3. Consider accessibility: While not critical in this case, always follow web accessibility best practices.

Conclusion

Opening Magento product pages in new tabs can create a better shopping experience for your customers by keeping them on your site as they explore different products. By simply adding the target="_blank" attribute to your anchor tags, you can achieve this functionality with minimal effort.

Remember that while this is a simple solution, it’s important to use it thoughtfully and in conjunction with other best practices for user experience and accessibility. To learn more about enhancing Magento’s core features, explore our comprehensive guides at Laravel Company.

Catalog Errors CLI

Our network