How can I prevent a Link Block in Webflow from opening in a new tab even when the "open in new tab" option is not checked in the Link Setting?

Published on
September 22, 2023

To prevent a Link Block in Webflow from opening in a new tab, even when the "open in new tab" option is not checked in the Link Setting, you can utilize custom code. Here's how you can achieve this:

  1. Select the Link Block element in the Webflow Designer.
  2. Go to the Settings panel on the right-hand side.
  3. Under Link Settings, uncheck the "Open in new tab" option.
  4. Click on the element's settings icon again and choose "Add Field" from the dropdown menu.
  5. Name the new field something like "target" and set the field type to "Plain text" or "Dropdown".
  6. In the Link Block element's settings, you will now see the new "target" field. Open it and set the value to "_self" (without quotes) if using plain text, or create a dropdown with an option for "_self" if using that field type.

Using this method, the Link Block will no longer open in a new tab, regardless of the "open in new tab" option being checked or unchecked. The custom code essentially forces the link to open in the same tab by setting the target attribute.

Note: If you want to apply this attribute to multiple Link Blocks, you can use multi-reference or collection lists and apply the code to the corresponding template page or CMS collection template.

In summary, to prevent a Link Block in Webflow from opening in a new tab, follow these steps:

  1. Uncheck the "Open in new tab" option in the Link Setting.
  2. Add a new field called "target" in the element's settings.
  3. Set the value of the "target" field to "_self".

This will ensure that the Link Block opens in the same tab.

Additional questions:

  1. How can I make a Link Block open in a new tab in Webflow?
  2. What is the purpose of the "target" attribute in HTML?
  3. Can I use custom code in Webflow to achieve advanced functionality?