.shouldOpenUrl()
This API is used to set the URL click behavior in the chat. If this value is passed as true, clicking on a URL will redirect to the specific URL. Else action block inside the ZohoSalesIQ.EVENT.HANDLE_URL event listener will be followed while clicking an URL link.
Syntax
CopiedZohoSalesIQ.Chat.shouldOpenUrl(boolean open);
Example
The below code opens the URL directly from the SDK and also the action block will be executed on clicking the URL.
CopiedZohoSalesIQ.Chat.shouldOpenUrl(true);
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT.HANDLE_URL, function(chat) {
console.log(chat.url);
});
If shouldOpenUrl is false, only the action block in ZohoSalesIQ.EVENT.HANDLE_URL event listener will be executed on clicking the URL and URL will not be opened.
Note: Please check the ZohoSalesIQ.sendEvent() API to open the URL by default when the shouldOpenUrl is false.
CopiedZohoSalesIQ.Chat.shouldOpenUrl(false);
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT.HANDLE_URL, function(chat) {
console.log(chat.url);
});