如何让Watson Assistant自动打开一个网页?

huangapple go评论96阅读模式
英文:

How do I get Watson Assistant to automatically open a webpage?

问题

我希望 Watson 在客户选择响应按钮时打开我的网站上的一个网页,可以在相同的标签页中打开,也可以在新的标签页中打开。

目前,我只是让 Watson 提供一个链接,客户必须手动点击并打开,而不是让 Watson 自动化这个过程。

英文:

I want Watson to open a webpage on my website, either in the same tab or in a new tab, when a customer selects a response button.

Currently, I'm just having Watson provide a link that the customer has to manually click and open, instead of having Watson automate it.

答案1

得分: 0

在同一标签页或新标签页中自动打开网页通常需要使用JavaScript,这是客户端的操作,因此超出了Watson的控制范围。

如果您想实现这一功能,您需要在您自己网站的代码上下文中执行它。以下是一个简单的JavaScript示例:

window.open('http://www.example.com', '_blank');

这行代码将打开一个新的标签页(因为有_blank参数),并导航到"http://www.example.com"。如果您想在同一标签页中打开URL,可以使用:

window.location.href = 'http://www.example.com';

然而,将这与Watson Assistant集成将取决于您的网页设置。通常情况下,您会根据特定的用户交互或从聊天机器人接收到的消息触发这样的脚本。

英文:

Opening a web page automatically, either in the same tab or in a new tab, usually uses JavaScript, which is client-side and therefore out of Watson's control.

If you want to implement this, you will need to do it in the context of your own website using your website's code. Here is a simple JavaScript example:

window.open('http://www.example.com', '_blank');

This line of code will open a new tab (because of the _blank parameter) and navigate to "http‍://www.example.com". If you want to open the URL in the same tab you can use:

window.location.href = 'http://www.example.com';

However, integrating this with Watson Assistant will depend on your web page setup. Typically, you'll trigger such a script based on a specific user interaction or message from a chatbot.

huangapple
  • 本文由 发表于 2023年5月28日 11:55:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/76349866.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定