(function() {
'use strict';
- const chatWebsiteAddressOrigin = '{{{chatWebsiteAddressOrigin}}}'
- if(chatWebsiteAddressOrigin !== window.location.origin){
- alert(`The current location does not match ${chatWebsiteAddressOrigin}. Please check your website domain in the current XCALLY Chat Website settings.`)
+ try {
+ const chatWebsiteAddress = new URL('{{{chatWebsiteAddressOrigin}}}')
+ if (chatWebsiteAddress.origin !== window.location.origin){
+ throw new Error(`Domain "${window.location.origin}"" can't load snippet for '{{{chatWebsiteAddressOrigin}}}'. Please check your website domain in the current XCALLY Chat Website settings.`)
+ }
+ } catch (error) {
+ window.alert(`Domain ${window.location.origin} can't load snippet for '{{{chatWebsiteAddressOrigin}}}'. Please check your website domain in the current XCALLY Chat Website settings.`)
+ return
}
- else
- {
// Init all URLs
const remoteURL = new URL('{{{remote}}}')
const chatOrigin = remoteURL.origin
<% if (hideWhenOffline && intervalId != null) { -%> // hide template
document.getElementById("motion-chat-iframe-tab").style.display = "none";
<% } -%>
- }
}());
\ No newline at end of file