Cross Domain issue : HTML [duplicate] - javascript

This question already has answers here:
How to show google.com in an iframe?
(9 answers)
Closed 7 years ago.
<iframe src ="http://google.com" width="400" height="300">
<p>Your browser does not support iframes.</p>
</iframe>
How can i get this result done?
I know CORS and jsonp are solution for this . But i really dont know how to implement it . I dont have any javascript on my pages . Just normal html pages. If its not possible doing just html codes then how can i achieve my goal using
javascript
or
jquery
.I want to get google.com in my iFrame .

Google is preventing you from embedding their website into your iFrame, since you're not on the same domain (*.google.com).
Also: there are a ton of questions like this. Check this answer in particular -- it's not what you want, but it might be good enough.

Related

How to make PDF files display on Android with <iframe></iframe> [duplicate]

This question already has answers here:
HTML set a blob (PDF) url in an iframe doesn't work on mobile
(2 answers)
Closed last month.
I have a project to display PDF files with iframes that appear on computer or Android just fine. After I tried to make my simple project, I had trouble displaying PDF files on Android. Can you help me so that my project can be completed.
My Code is
<iframe src="file.pdf" width="100%" height="500px"></iframe>
Display on android as below
And Whereas when I access it on a computer like below
I want this PDF file to also display properly on Android like I access it on computer
Have you try something like this ? :
<iframe src="path/file.pdf" width="100%" height="500px">
For the next time, try to add the code you used to better understand how you got there

How To Add Youtube Video On A Webpage [duplicate]

This question already has answers here:
What is the best way to embed Youtube videos? [closed]
(2 answers)
Closed 2 years ago.
I am still pretty new to web developing and i am trying to create a new website for fun and just to test my skills so forget me if i m asking alot from this platform.
but i wanna add a youtube video to my webpage and i can't find anything on stack overflow regarding this but can anyone show me a platform where i can copy/paste the code or someone provide me with it again sorry if asking a lot i have tried github,stack overflow and tried finding on google but everything is related to something else :( any help would be apreciated thank you in advance
You can embed the video on your page using <iframe>. You can find instructions here.
The embed code can easily be found by clicking share button on any YouTube video.
If you're using HTML5, the best way to achieve this is by using the <iframe> tag.
Here is an example (you'll find some stupid dolls jumping and moving):
<iframe src="https://www.youtube.com/embed/tgbNymZ7vqY"></iframe>
autoplay=1 will make the video playing when the page is loaded:
<iframe src="https://www.youtube.com/embed/tgbNymZ7vqY?autoplay=1"></iframe>
But there are two deprecated tags in HTML, I don't recommend to use them.
They are <object> and <embed>.
An example of using <object>:
<object data="https://www.youtube.com/embed/tgbNymZ7vqY"></object>
Another example if using <embed>:
<embed src="https://www.youtube.com/embed/tgbNymZ7vqY">

It is possible to make a requestFullscreen () in an iframe [duplicate]

This question already has answers here:
How to make a video fullscreen when it is placed inside an iframe?
(5 answers)
Closed 3 years ago.
I'm writing code that generates a <iframe> so that other people can put this code on their sites, one of the functions of this <iframe> is requestFullscreen();
This request is working optimally, but it does not allow to do this in a cross domain.
Below is an image representing the structure of the elements.
PHP main page code
<div id="alpha">
A simple full screen template
</div>
JS code
$(document).ready(function(){
$('a').click(function(){
var screenresize = $('#alpha').get(0);
screenresize.requestFullscreen();
return false;
});
});
Cross domain HTML/PHP code
<iframe src="http://experimental.devz/iframe.php"></iframe>
I know it's possible to do this because youtube also works the same way, although your code is scrambled, I know it does it or similar.
You will need an iframe with the attribute allow="fullscreen"
Set allow="fullscreen can activate fullscreen mode by calling the requestFullscreen() method.
See this iframe: The Inline Frame element
Example:
<iframe allow="fullscreen" src="http://experimental.devz/iframe.php"></iframe>

How to disable a website if javascript is disabled [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
Like "Facebook", I want to disable all of my website content if "JavaScript" is disabled. When JavaScript is disabled Facebook only shows a message .
"JavaScript Required We're sorry, but Facebook doesn't work properly
without JavaScript enabled. If you can't enable JavaScript try
visiting the mobile-optimized website. "
Now what i'm trying to do is, if anyone disable JavaScript, they will only be able to show a message, nothing else.
How can I do that?
this will redirect to javascriptNotEnabled.php
<noscript><h3> You must have JavaScript enabled in order to use this order form. Please
enable JavaScript and then reload this page in order to continue. </h3>
<meta HTTP-EQUIV="refresh" content=0;url="javascriptNotEnabled.php"></noscript>
How??
What you should do is create a div that fills the entire page using html and css, then right after window.onload, remove that div
<div id="nojs" style="width:100%;height:100%;position:fixed; background-color:white;">
<h1>Enable JavaScript!</h1>
</div>
<script>
window.onload = function () {
document.getElementById('nojs').parentElement.removeChild(document.getElementById('nojs'));
}
</script>
noscript doesn't can't disable the whole page as far as I am concerned
Fiddle while JSFiddle doesn't work without JavaScript, the code still is an example
PHP is a server-side and can't analyze such settings of your browser.
But, You can just use javascript <noscript> tag to do this
The <noscript> tag defines an alternate content for users that have disabled scripts in their browser or have a browser that doesn't support script.
Read more about <noscript> from the w3 resource here
<script>
document.write("Hello World!")
</script>
<noscript>Please enable JavaScript!</noscript>
load the site contents via javascript.
Your page should look like:
<html>
<body>JavaScript Required We're sorry, but Facebook doesn't work properly without JavaScript enabled. If you can't enable JavaScript try visiting the mobile-optimized website.</body>
<script>
document.getElementByTagName("body").innerHTML = "";
</script>
<script src="loadPage.js"></script>
</html>

Is there any way to get external pagess via JavaScript on iframe? [duplicate]

This question already has answers here:
Getting iframe content's height while iframe is hosting an EXTERNAL website whose code CAN'T be accessed [duplicate]
(2 answers)
Closed 8 years ago.
I was able to load internal pages with full width successfully using this
<script type="text/javascript">
function calcHeight()
{
//find the height of the internal page
var the_height=
document.getElementById('the_iframe').contentWindow.
document.body.scrollHeight;
//change the height of the iframe
document.getElementById('the_iframe').height=
the_height;
}
</script>
<iframe width="100%" src="/mypage.php"
scrolling="no" id="the_iframe" onLoad="calcHeight();" height="1px" frameborder="0" ></iframe>
This is working great for any INTERNAL pages (page from same domain). I am struggling to get it work with external pages (cross-domain) but didnt find any solution.
IT SEEMS IT IS IMPOSSIBLE TO DO CROSS DOMAIN COMMUNICATION WHICH I REALLY DIDN'T EXPECT. WHATEVER, THANK YOU ALL.
It is impossible to access the contents of iframes that are referencing cross domain urls.

Categories