Expand my Community achievements bar.

SOLVED

auto height of iframe for a cross domain url

Avatar

Level 2

 I am using CQ5.6.1 ,In a iframe I wanted to auto height an external URL content (say http://rediffmail.com) in CQ5,but found that cross scripting issue is coming up.

when I am doing an javascript manuplation.I see it throws error permission denied to access property 'document' iframe

So how could i solve this problem.

I saw one of the option as X-Frame-Options, is there any other better method.

can some one point out how to add the  X-Frame-Options in CQ5,Any code snippet will be helpfull.
1 Accepted Solution

Avatar

Correct answer by
Level 9

Recently we faced the same issue, if you have any external link in author environment. CQ5 doesn't allow it to be opened in iframe. 

We added  a function to detect whether it is an internal link or external link anything that starts with /content is an internal link.

If it is an external link we set the href target to _top. this will replace the top window for external link. Authors will loose cf# for any external link, but you can have target as _blank if it is an external link.

I know there may be another way to modify cross domain policy but we don't want to touch out of box settings.

View solution in original post

3 Replies

Avatar

Correct answer by
Level 9

Recently we faced the same issue, if you have any external link in author environment. CQ5 doesn't allow it to be opened in iframe. 

We added  a function to detect whether it is an internal link or external link anything that starts with /content is an internal link.

If it is an external link we set the href target to _top. this will replace the top window for external link. Authors will loose cf# for any external link, but you can have target as _blank if it is an external link.

I know there may be another way to modify cross domain policy but we don't want to touch out of box settings.

Avatar

Level 2

I see that the solution you mentioned is that iframe will open up in a new window.

But i want i iframe to open up in the same page.

 

As I have iframe component and some other componets add on the same page.

Please let me know if any solution is there for same

Avatar

Level 9

We had the same requirements to open in same window so we

used _self for internal and _top for external 

With external links u lose content finder frame