Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am trying to render some thing like this. not exactly google though.
Can some body guide me what needs to be done to achieve this? I just want to render one domain page from another domain using iframe tag.

What I have tried:

<iframe src="https://www.google.com">
</iframe>
Posted
Updated 23-May-19 1:00am
Comments
F-ES Sitecore 23-May-19 8:43am    
That's how you do it. If it isn't working for the site you want then that will be down to the site itself. Given you can't change or control the site you are trying to put in a iframe there is nothing you can do if that site doesn't want to be framed.
W Balboos, GHB 23-May-19 8:47am    
Generally, it should just work - what do you see (or not see?).
If you see nothing at all, then just for laughs, give it a real length and width.
If you see an empty rectangle, try copy/paste from your URL. First, another page in your domain and then other. Just t be sure you've got your syntax correct.

1 solution

You cannot. Google servers will not accept any CORS (Cross-Origin Resource Sharing)[^] request. Allowing that would be a major security issue.
The iframe tag is not responsible for this behaviour, there is nothing you can do, server or client-side, to prevent that: it is the target server of the iframe (i.e., google) which explicitly refuses to serve your request.
[Edit]: replace 'google' by what is appropriate in your case :)
 
Share this answer
 
v2
Comments
goshan2011 23-May-19 7:31am    
"google" was just an example i have quoted. But what do i have to do in my server to open up in that way. Please suggest. In the place of google, when i tried "tutorialbrain", it opened up in iframe, where as one domain of mine dont open up in another.
phil.o 23-May-19 7:51am    
It was not clear whether the external domain was one of yours.
As I said, it is something that has to be done on the target domain.
Maybe I want to add CORS support to my server[^] can help you then.
Richard Deeming 24-May-19 14:28pm    
It's not really CORS that controls this; it's the Content Security Policy (CSP)'s frame-ancestors directive.
CSP Cheat Sheet[^]

Prior to that, the X-Frame-Options[^] header served a similar purpose.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900