Issue with loading an iframe in Sightly (AEM 6.2) | Community
Skip to main content
Level 2
Aug 3, 2017 7:23 AM UTC
Solved

Issue with loading an iframe in Sightly (AEM 6.2)

We have created a component for iframe in touch UI and created a model class, We are trying to load a URL with some parameters

below is the code snippet for reference

     <sly data-sly-use.model="com.test.IframeModel">

           ${model.url @ context='uri'}

          <iframe src="${model.url @ context='uri'}"></iframe>

  </sly>

   

generated dome

Source image file 7090 not available

if we try to display the URL outside iframe src URL is printed on the page, and when hard code the URL sent from backend in the iframe it is loading properly

          <iframe src="https://www.mysite.com/?abc=134&fgr=qwe"></iframe>

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
ritikas56571222Accepted solution
Level 2
Aug 3, 2017 2:46 PM UTC

Thanks for the help guys, I tried context unsafe as well, but it was not working. There was some issue with the value of the parameter which contained [], which was working fine on browser and when hard coded in iframe src, but the XSS filtering was not passing it despite Context set as unsafe,

There was some issue with the value of the parameter it contained [], which was working fine on the browser and when hard coded in iframe tag src, but some the sightly XSS filtering was not allowing it despite setting Context as unsafe. We are now encoding the values and sending it to the component it is working fine now

10 replies

Level 2
Aug 3, 2017 4:02 PM UTC

Hi Veena

As I mentioned earlier, we have "[0]" in the param value which was causing the issue. It was fixed after encoding the values

Translate
VeenaVikraman
New Participant
Aug 3, 2017 3:59 PM UTC

I am getting this as susheel mentioned

I have not tried the model part. I will let you know if I am able to replicate the issue that way.

Translate
VeenaVikraman
New Participant
Aug 3, 2017 2:48 PM UTC

ok. So that means still its not loading. Let me try this out for you.

Translate
ritikas56571222AuthorAccepted solution
Level 2
Aug 3, 2017 2:46 PM UTC

Thanks for the help guys, I tried context unsafe as well, but it was not working. There was some issue with the value of the parameter which contained [], which was working fine on browser and when hard coded in iframe src, but the XSS filtering was not passing it despite Context set as unsafe,

There was some issue with the value of the parameter it contained [], which was working fine on the browser and when hard coded in iframe tag src, but some the sightly XSS filtering was not allowing it despite setting Context as unsafe. We are now encoding the values and sending it to the component it is working fine now

Translate
VeenaVikraman
New Participant
Aug 3, 2017 2:38 PM UTC

ritikas56571222

     What I believe here is , it could be that since you have some query parameters in your URL, it is considering as an invalid link due to XSS protection. You may have to switch off the XSS protection in this case (which is not normally recommended)

Translate
susheel
Level 5
Aug 3, 2017 12:41 PM UTC

<sly data-sly-test.model="${'https://www.google.co.in'}"/>

<iframe src="${model @ context='uri'}"></iframe>

Translate
Level 2
Aug 3, 2017 12:01 PM UTC

Can you please share the code snippet of your model class and iframe for reference.

Translate
susheel
Level 5
Aug 3, 2017 11:34 AM UTC

I tried similar code, I am not able to reproduce the issue.

src tag is visible.

Translate
Level 2
Aug 3, 2017 9:37 AM UTC

Hi Sunil

Yes I can see Iframe, but there is no src property in that, Please find attached dom

Translate
susheel
Level 5
Aug 3, 2017 8:32 AM UTC

Hi ritika,

Are you able to see the iframe along with url in view source ?

The image you attached in the question is broken. Can you update that.

Translate