# Change Behavior of AI Chatbot Generated Hyperlinks

**URL:** https://community.elfsight.com/t/change-behavior-of-ai-chatbot-generated-hyperlinks/142362
**Category:** General Questions
**Tags:** ai-chatbot
**Created:** [December 11, 2025, 4:56pm UTC](https://community.elfsight.com/t/change-behavior-of-ai-chatbot-generated-hyperlinks/142362 "2025-12-11T16:56:19Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Petar\_Dietrich](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/petar_dietrich/32/92003_2.png) [@Petar\_Dietrich](https://community.elfsight.com/u/Petar_Dietrich)
#### Post date: [December 11, 2025, 4:56pm UTC](https://community.elfsight.com/t/change-behavior-of-ai-chatbot-generated-hyperlinks/142362/1 "2025-12-11T16:56:19Z")

</div>

Howdy,

AI Chatbot-generated hyperlinks always open in a new tab. Questions:

1. Is this the natural behavior of your AI Chatbot widget?
2. Is there a way to override this? Meaning, I’d like same-site hyperlinks to open in the same tab, and all others (i.e., external links) to open in a new tab. Unfortunately, AI bot training did not help.

Thank you!

---

<div class="post-metadata">

### Author: ![Max](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/max/32/710_2.png) [@Max](https://community.elfsight.com/u/Max)
#### Post date: [December 11, 2025, 5:03pm UTC](https://community.elfsight.com/t/change-behavior-of-ai-chatbot-generated-hyperlinks/142362/3 "2025-12-11T17:03:22Z")

</div>

Sure! Your request is with our devs now, and I’ll update you once the solution is ready 🙂

---

<div class="post-metadata">

### Author: ![Max](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/max/32/710_2.png) [@Max](https://community.elfsight.com/u/Max)
#### Post date: [December 12, 2025, 8:43am UTC](https://community.elfsight.com/t/change-behavior-of-ai-chatbot-generated-hyperlinks/142362/4 "2025-12-12T08:43:48Z")

</div>

Hi there, @Petar_Dietrich 👋

Thank you for waiting!

We’ve added this code to the Custom JS field on the General tab of your widget’s settings:

```auto
const HOST_NAME = 'omniaaerospace.com';
document.addEventListener('click', (event) => {
	const link = event.target.closest(
		`.eapps-ai-chatbot-${WIDGET_ID}-custom-css-root a`
	);

	if (!link) {
		return;
	}

	event.preventDefault();
	if (link.href.includes(HOST_NAME)) {
		window.open(link.href, '_self');
	} else {
		window.open(link.href, '_blank');
	}
});

```

  

Please check it out and let me know if you like the result 🙂

---

<div class="post-metadata">

### Author: ![Petar\_Dietrich](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/petar_dietrich/32/92003_2.png) [@Petar\_Dietrich](https://community.elfsight.com/u/Petar_Dietrich)
#### Post date: [December 12, 2025, 3:06pm UTC](https://community.elfsight.com/t/change-behavior-of-ai-chatbot-generated-hyperlinks/142362/5 "2025-12-12T15:06:45Z")

</div>

Hey @Max,

Tested. It worked. Thank you!

**Notes** :

1. For future reference, please **do not modify our CSS or JS code directly in our widget**. As you’ve done before, please post the code in your reply and I will enter/test it at my end. Main reason: The current CSS and JS Code fields are small and narrow. With all the code we have entered, things can get a bit confusing without a “Comment” for each code. A single stream of code can create a lot of downstream issues.

2. As suggested before, Elfsight developers are providing many useful JS Codes that apply universally to all customers. Please add a “ **JS Codes** ” category to the Community Board as you’ve done for “ **CSS Codes** ” This will help your customers find useful JS Codes fast.

Cheerio!

---

<div class="post-metadata">

### Author: ![Max](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/max/32/710_2.png) [@Max](https://community.elfsight.com/u/Max)
#### Post date: [December 12, 2025, 3:17pm UTC](https://community.elfsight.com/t/change-behavior-of-ai-chatbot-generated-hyperlinks/142362/6 "2025-12-12T15:17:14Z")

</div>

Got it, thanks!

We’ll think about introducing a separate category for the JS codes, and sorry for the confusion by adding the codes right away. We’ll just post them in the messages in the future 🙂

---

<div class="post-metadata">

### Author: ![Petar\_Dietrich](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/petar_dietrich/32/92003_2.png) [@Petar\_Dietrich](https://community.elfsight.com/u/Petar_Dietrich)
#### Post date: [December 12, 2025, 3:20pm UTC](https://community.elfsight.com/t/change-behavior-of-ai-chatbot-generated-hyperlinks/142362/7 "2025-12-12T15:20:38Z")

</div>

Thanks, @Max!

Everybody wins!

By the way, I truly admire and appreciate your dedication to the community and your customers.

Keep up the great job. I think you’re ready for a promotion! 😁

Salud!

---

<div class="post-metadata">

### Author: ![Max](https://sea2.discourse-cdn.com/flex020/user_avatar/community.elfsight.com/max/32/710_2.png) [@Max](https://community.elfsight.com/u/Max)
#### Post date: [December 12, 2025, 3:53pm UTC](https://community.elfsight.com/t/change-behavior-of-ai-chatbot-generated-hyperlinks/142362/8 "2025-12-12T15:53:07Z")

</div>

Many thanks for your kind words! That’s exactly what inspires us to always move forward ❤
