auto height of iframe for a cross domain url | Community
Skip to main content
srinivas_channa
Level 2
October 16, 2015
Solved

auto height of iframe for a cross domain url

  • October 16, 2015
  • 3 replies
  • 1961 views

 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.
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Mshaji

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.

3 replies

MshajiCommunity AdvisorAccepted solution
Community Advisor
October 16, 2015

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.

srinivas_channa
Level 2
October 16, 2015

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

Community Advisor
October 16, 2015

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