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

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

Related

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

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.

How to set iframe correctly in web page

Here I give an code. I want to set the iframe but is not showing anything. I don't understand what is the problem.
<iframe src="https://twitter.com/money2020"></iframe>
"Twitter's site blocks direct iframe display through the secure hypertext transfer protocol, which keeps someone from making a direct iframe to any given page on Twitter. Instead, Twitter widgets need to be created through the corresponding Twitter account to be embedded on a site within an iframe."
http://www.wikihow.com/Create-a-Twitter-Hashtag-Widget
https://twitter.com/settings/widgets

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!

how can I navigate to a new page without reloading part of the current page?

I have a mybb forum, and a plugin that adds a public/private chat to the bottom of the forum (it adds a div before </body>).
I would like to navigate the forum without reloading the chat.
In this question, Josh Stodola explains how to change the url.
In this question, there is a small JavaScript code to change the url.
I've also read about HTML5 iframes, but I still can't imagine how can I use it all together.
Should the chat be inside an iframe? an iframe inside the forum? should the forum be inside an iframe, and the chat into another? And those 2 iframes, inside a new page???
I'm messed up...
You should have a window containing chat and an iframe for your content. This will allow you to navigate your forum and only reload the iframe vs the top frame.
<body><iframe src="someurl"></iframe><div>Chat</div></body>
A few things to note: doing it this way will not change the address bar while you navigate and this makes users confused when they try to link to pages and it takes them to the home page or wherever they started browsing your forum.
If you want to do something more fancy checkout pjax. It will let you change urls for the whole page while only loading certain content.

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.