Reputation: 45
I am trying to embed external websites into my website so I can reference a website and have it show the website. I have tried doing this using this code:
<iframe src="<WEBSITE URL>" width="100%" height="300"></iframe>
This works for some websites like www.wikipedia.org but when I try other websites like www.twitter.com I just get an error message that says: "twitter.com refused to connect." What can I do to get these other websites to be embedded into my website?
Upvotes: 3
Views: 18023
Reputation: 207557
A website owner has the option to not allow it to be embeded in other sites. They can do this by using the X-Frame-Options header. There is nothing you can do on your end to bypass this.
Running the curl command curl -I https://twitter.com
you can see the list of headers and x-frame-options: DENY
is one of them.
... snipped
x-content-type-options: nosniff
x-frame-options: DENY
x-response-time: 19
x-transaction: 00fafa890079c168
x-twitter-response-tags: BouncerCompliant
x-ua-compatible: IE=edge,chrome=1
x-xss-protection: 0
Upvotes: 7