Embed the Virtual Agent chat widget in an external web page (legacy method)
Load the Virtual Agent chat widget interface in an external web page by using an inline frame element (iframe). You can also optionally enable the single sign-on (SSO) authentication process to run automatically for guest users who are using the chat widget and are not logged in.
Before you begin
- In the iframe, you specify the URL of the instance to be embedded. If you're embedding the chat widget on any page that is not on your ServiceNow instance, the URL must be a custom instance URL. Due to increased browser security, the chat widget may fail to load if you don't use a custom URL. To learn more about using custom URLs, see Associating custom URLs to your instance. To use a custom URL, do the following:Note:The Virtual Agent chat widget does not work from an iframe in Safari by default. Apple blocks cross-origin iframes (when the domain of the URL used in the iframe does not match the domain of the website itself).
After you embed the Virtual Agent client, you can optionally trigger SSO authentication from the chat widget, but only when your instance is set up to use an external SSO provider. Your hosting site must also use the same SSO provider as your instance. For details on setting SSO providers, see External single sign-on (SSO).
To trigger SSO authentication, you create a JavaScript script that defines conditions for running authentication and redirects users to a chat widget page that you specify (see Step 2 below). You also specify the allowed URLs that can be passed in this script, by identifying them in the com.glide.cs.web_client_login_redirect_urls system property. Specify the full redirect URLs or the host part of the URL, such as https://example.com .
Role required: admin
About this task
- com.glide.cs.embed.csp_frame_ancestors
- com.glide.cs.embed.xframe_options
window.postMessage() method (Web API) to trigger
authentication and specify the URL where users are redirected after authentication.
For more information on this method and Window objects, see Window.postMessage().