Using Iframe in Service portal

salomesimpsone
Giga Contributor

Hi all,

I am learning about service portal

what I am trying is to display an external page(e.g google,...)using iFrame in service portal.

So, I created a widget and included the iframe as below

<iframe src="http://www.w3schools.com" height="500px" width="500px"></iframe>

but expected page is not getting displayed and the iframe is blank

How to use iframe in service portal??

Thanks in advance

1 ACCEPTED SOLUTION

Hi Salome,



That error would occur in service portal as well as CMS as the error is telling you that the content provider of the content displaying in the iframe has block access to it within an iframe. Service Portal was actually written so we wouldn't have to use frames anymore. For your case, I would just link out to that external content rather than trying to display it in an iframe.


View solution in original post

20 REPLIES 20

Andrea A
Tera Contributor

find_real_file.png
The body HTML template of the widget, contains just this 
<div>
<iframe ng-src="{{target_url}}" width="100%" height="100%" style="border:none;">
</div>

The URL must be in an iframe otherwise it isn't shown (Customer configurations prevents the ''direct'' link)
Even though everything is in the iframe tag, this isn't working.
If we create a UI page with the iframe tag, it works.
How can we arrange this?

Are you seeing any errors in the browser console?

I would dump out the URL to the console to make sure its what you think it is and then do some searching on AngularJS and iFrames.  I say this because this is an angular issue and not necessarily a ServiceNow, especially since you say a UI page works.

Andrea A
Tera Contributor

Hi,
attached you can find the only error I see in the console

The only thing I can suggest is add {{target_url}} to the HTML someplace that will allow you to see it so you can verify it is what you think it should be.  After that I would check your browsers security settings.

I'm using this in three different places on two different SP's and it works.  But our URL's are trusted internal cooperate sites.

 

hurm
Tera Contributor

I want to display the contents of an external link, but it seems that there are security restrictions. Could you tell me about the security settings for displaying external links?

 

zhian_0-1666330689780.png