Gravatar for sara.kevorkian@avanade.com

Question by sdkevorkian, Jul 16, 2018 5:27 PM

result links are opening in new tab by default

Do you know anything that would or could cause the CoveoResultLinks to open in a new tab by default? I am trying to add target=”_self” and data-always-open-in-new-tab=”false” to force it not to but something seems to be overriding the default behavior.

We are using Angular 1.x also

Gravatar for flguillemette@coveo.com

Comment by François Lachance-Guillemette, Jul 16, 2018 5:42 PM

By default, `CoveoResultLink` should open the result on the same page.

Can you validate that you do not have onClick events bound to those elements? Or an `<a href>` tag wrapping this link?

Plus, `data-always-open-in-new-tab` is not a valid option. It should be data-always-open-in-new-window instead.

1 Reply
Gravatar for sara.kevorkian@avanade.com

Answer by sdkevorkian, Jul 16, 2018 8:44 PM

on document load, they had a click handler that on all a tag elements. in the click handler, they check for a hardcoded string of the production URL, and if it doesn't exist did this:

event.preventDefault();
window.open(this.href);

of course all our testing is in local/Qa/PreProd so they are preventing default on every link.

Ask a question