Help with Virtual Agent

Virendra Dwived
Tera Expert

Hi Everyone;

 

I am trying to embed virtual agent window into external page.

Method: 

 

Step 1: Obtain the URL for embedding the chat

ven04940.service-now.com/sn_va_web_client_app_embed.do

 

Step 2:Copy the URL and add it into an iframe element

<iframe src="https://ven04940.service-now.com/sn_va_web_client_app_embed.do" title="Test"></iframe>

 

Step 3: Enable iframe embedding of the chat in NOW.

system property.PNG

 

After following above steps I am getting error like this:

site.PNG

And it is saying ven04940.service-now.com refused to connect.

Can anyone guide me with this.

 

cc: @Ankur Bawiskar @Community Alums @Pavankumar_1 @kamlesh kjmar 

 

Thanks in advance

1 ACCEPTED SOLUTION

Hi @Virendra Dwived ,

 

My previous post was generic for servicenow pages, I missed your question was specific to VA embedding. For VA embeddment servicenow has given a way to override 'sameorigin' policy using system property. The property that you have overridden as shown in the screen shot is the right one. The issue that is there is the format of the URL you have used. You don't need to provide the page level URL. Just mention the base URL of teh site where you want to use it. 

 

For an example, let's say I want to embed my VA in w3school web site, in that case I will mention that site's base URL and seave , as shown in the below screen shot:

 

kamleshkjmar_0-1690437062060.png

 

If you put a close attention to the screen shot, you will find value of the property I have set as space separated, you can include multiple sites just make sure all are space separated. 

 

kamleshkjmar_1-1690437225650.png

 

As you can see in the above screent shot, it's working now.

I hope this helps.

 

Please mark this post as Helpful if this helps and Accept if it resolves your issue.

 

Regards,

Kamlesh

 

View solution in original post

2 REPLIES 2

kamlesh kjmar
Mega Sage
Mega Sage

Hi @Virendra Dwived ,

 

Unfortunately, you can't do this. What you are getting is an expected behaviour. Any page of servicenow can't be embeded as iframe in any other site. Doing this violates the Content Security Policy directive. As per this directive any page can be embedded only on a site of the same origin. In simple term you can embed servicenow page as an iframe on the same instance page only, as in that case origin of the page to be embeded and page on which it is embedding are same.

 

So, if I try to embed a page that belongs to your instance on a page of my instance it won't work and will throw below errors.

 

kamleshkjmar_0-1690432333193.png

kamleshkjmar_1-1690432576967.png

 

 

But I can embed any page of my instance on any other page of my instance.

 

You can learn more about Content Security Policy (CSP) here 

 

I hope this helps.

 

Please mark this post as Helpful if this helpa and Accept if it resolves your issue.

 

Regards,

Kamlesh

Hi @Virendra Dwived ,

 

My previous post was generic for servicenow pages, I missed your question was specific to VA embedding. For VA embeddment servicenow has given a way to override 'sameorigin' policy using system property. The property that you have overridden as shown in the screen shot is the right one. The issue that is there is the format of the URL you have used. You don't need to provide the page level URL. Just mention the base URL of teh site where you want to use it. 

 

For an example, let's say I want to embed my VA in w3school web site, in that case I will mention that site's base URL and seave , as shown in the below screen shot:

 

kamleshkjmar_0-1690437062060.png

 

If you put a close attention to the screen shot, you will find value of the property I have set as space separated, you can include multiple sites just make sure all are space separated. 

 

kamleshkjmar_1-1690437225650.png

 

As you can see in the above screent shot, it's working now.

I hope this helps.

 

Please mark this post as Helpful if this helps and Accept if it resolves your issue.

 

Regards,

Kamlesh