<iframe> | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

<iframe>

<div class="section"> <h1><span>My Resources</span></h1> <iframe height="150" width="300" src="https://www.youtube.com/embed/Q6_5InVJZ88" allowfullscreen frameborder="0"></iframe><br/> <iframe height="150" width="300" src="https://www.w3schools.com/" allowfullscreen frameborder="0"></iframe> </div> second iframe results in "refused to connect" err msg. please help src="https://www.sololearn.com" works but src="https://www.youtube.com" does not - why is that? - same error "(URL) refused to connect" same for all of these sites: google, yahoo, msn, facebook - can it be that all of these sites are restricted? how is it that Youtube homepage is restricted but specific this youtube video is not? I thought it may be an issue of internal access but running the script from my own text editor yields the same result

30th Aug 2020, 7:18 PM
Teets
6 Answers
+ 3
It might, if they are aware of a risk through an embedded link in an iframe, better not allowing it as damages can be severe. It also protects you from being hacked through that . https://www.tinfoilsecurity.com/blog/protect-your-website-from-embedded-content-iframe-security For YouTube, which is also Google, maybe they have a way to handle it but recently on the forum , someone was complaining of an access origin problem (quite similar to your), so it might depends also of some other criteria. Maybe it also have to do with some commercial/SEO reasons....
30th Aug 2020, 8:46 PM
EmmanueLZ.
EmmanueLZ. - avatar
+ 1
I didn't imagine the community would be so repsonsive. thank you both very much. If you have more info please let me know
30th Aug 2020, 8:52 PM
Teets
+ 1
Teets Not sure but I think, It may mainly becouse of server refusing to secure their sites.. It may protocol response not match... Most sites prevent access from iframe. Youtube home page more secure than specific parts because which are user pages and user channels.. securing those is difficult... These may help you answer accurately.. https://stackoverflow.com/questions/14544969/iframe-not-working-for-some-sites https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
30th Aug 2020, 9:25 PM
Jayakrishna 🇮🇳
+ 1
This website has set this header to disallow it to be displayed in an iframe. There is nothing a client can do to stop this behaviour. Try to set the link in anchor instaed of iframe.
31st Aug 2020, 1:54 AM
Divya Mohan
Divya Mohan - avatar
0
Try other sites.. That site is restricting access.. May not possible.. I mean code have no errors..!
30th Aug 2020, 8:19 PM
Jayakrishna 🇮🇳