How to see the content of iframe in html [duplicate] - html

I have two internal sites. I'm trying to show one's content in the iframe of the other site. However I'm getting this message: "This content cannot be displayed in a frame." I've read the reason I'm getting this message but, I would like to bypass it since the sites are internal and I'm not concerned with someone trying to hijack my users. I couldn't find a way to bypass it after searching the internet, but feel like it should be possible because the rest of the message seems to hint at it.
"To help protect the security of information you enter into this website, the publisher of this content does not allow it to be displayed in a frame."
Since I'm the publisher how can I allow it to be displayed in the frame? Thanks!

use <meta http-equiv="X-Frame-Options" content="allow"> in the one to show in the iframe to allow it.

The X-Frame-Options is defined in the Http Header and not in the <head> section of the page you want to use in the iframe.
Accepted values are: DENY, SAMEORIGIN and ALLOW-FROM "url"

Use target="_top" attribute in anchor tag that will really work.

Related

Trying to iframe a website in html, won't display webpage

I'm new to coding, trying to get https://www.timeanddate.com/ to show up in an iframe with html. I'm not trying to do anything fancy, I just want the site to show up in the iframe. I have a few other sites that I already have working, just having an issue with this one.
I have done some searching, and found that I may not be able to display this site due to them denying embedding on other sites.
Just asking for some assistance with some code to get this to work, if possible.
Thanks in advance.
This is becaused https://timeanddate.com site has the X-Frame-Options header set to SAMEORIGIN.
What this means is that the page can only be iframed on a page the resides on the same domain.
As an example https://timeanddate.com/test could have an IFrame containing the main site on https://timeanddate.com, because they are both from the timeanddate.com domain.
Mozillas documentation for X-Frame-Options

iframe in html CODE not able to load website

i am trying to load www.google.com in an iframe. But i am not getting required results.
Please help me to figure out the error.
here is the jsfiddle.
http://jsfiddle.net/vj04bk4d/
Mostly protected and famous sites have already protected it from grabbing their page inside an iframe. Some others are not, e.g. w3schools.com. you'll see the page appears inside the iframe. That's why it is impossible to do that on protected site. Some say that this is against privacy and policy.
This is frequently done by PTC site.
Please check here for further information:
jQuery/JavaScript: accessing contents of an iframe
(My first stackoverflow answer, so bear with me.)
As I read in this other stackoverflow post:
How do I load a URL specified in a textbox in an iframe?
the problem is not in the code, but in the fact that "some sites refuse to load the page inside an iframe (example: http://google.com)"
I have a similar tool done here:
http://www.carljohansson.net/tools/a-simple-responsive-viewer.php
where I load the url from an input[type=text] to be shown inside an iframe to test the responsiveness of a website. While testing your issue I saw that google wouldn't load either on my page.
Cheers!

Optimizing a Web Page to get it to embed well on Facebook, Embedly, et al

What code elements do I need to add/modify on a Web page to ensure that it gets embedded properly on a facebook status update?!
See below for an example of what I think is a good embed:
Some web pages I tried to embed don't appear very well on facebook i.e. when you put their links in a status update. Also, sometimes it gives you a selection of images to choose from?!
Is this purely a <meta> tag play, or are there other things I could do to ensure that the web page gets embedded the way I want it to (images and all)?!
Thanks.
Yes this is meta tags at work. You need to specify Open Graph metadata to define what appears on Facebook. See http://ogp.me/

Prevent iframe "This webpage is not available." error from displaying on website

Is there a way to prevent the error "This webpage is not available." from displaying within an iframe that displayed on another site?
For example, if I have a website and I want to display my Facebook fans in a box, one way to display it is with an iframe (typically Facebook supplied code). However, if for some reason Facebook is down or slow to respond (like it is right now), I get the following displayed on my website where the iframe should be displayed:
This webpage is not available.
The webpage
athttp://www.facebook.com/plugins/likebox.php?id=xxxxxxxxxx&width=182&connections=6&stream=false&header=true&height=287might
be temporarily down or it may have
moved permanently to a new web
address.
• More information on this error
Below is the original error message
Error 324 (net::ERR_EMPTY_RESPONSE):
Unknown error.
If Facebook (or the other website) is not available, I'd be happy not displaying anything, or displaying a graphic of the same size (height/width), or a host of other alternatives EXCEPT displaying an error on my homepage! It makes my site look broken to users.
Any and all ideas are welcome! Thanks in advance
You can use the iframe's onerror="" property to do something creative. Consider this:
<iframe src="foo.bar" onerror="this.location.reload();" />
Hope this helps
Edit: This no longer works.
If you are doing anything on the server-side you can test that URL and see if it returns a 404 error

How to make links break out of iframe when you only control the iframe page (not the framed pages)?

I have a site that displays other sites through an iframe on certain pages. It does this in order to display a toolbar that is relevant to the reader (like Facebook and Owly does). However, when the user chooses to leave the original site I want the bar to go away. As you might gather, I don't control the sites in the iframe, and they're on another domain than the iframing page.
I tried target="_parent" on the <iframe>, no luck. Then I tried various scripting solutions, but they all fail due to the same domain restriction. My last try was to have a timeout check for changes in the iframe URL, but iframe.contentWindow.location.href is restricted when page is on another domain (unlike the object iframe.contentWindow.location which I found a bit weird).
Any solutions to this problem? I know iframes aren't the hottest thing around, but they do the job in this case.
Try target=_top That should open the page in the full body of the window.
No solutions.
The only way to get a link to open in the top frame is to have access to the link itself. As you observed, the same origin policy prevents JS from outside the frame accessing it.