How to display external web page in mvc 5? - razor

I would like to display another web sides inside my mvc view.
Can anyone help me how to do this issue? I tried using iframe but i could not succeed it.

You can use <iframe> or <embed> or <object> tags in HTML5 to display 3rd other websites URL inside your application.
Example:
<iframe class="embed-responsive-item" src="http://modernpathshala.com" width="600" height="315" frameborder="0" allowfullscreen="allowfullscreen"></iframe>

<object type="text/html" data="External_URL" width="500px" height="500px">
</object>
Note : replace External_URL with your url

Related

Can you show youtube videos on your website without embedding them?

I have my site so that people can upload urls of the videos to the database and with php it should in theory display said video. I don't want to use the embed tag because that doesn't work from mobile device. Is there a way to use the videos with just the url's?
<video controls>
<source src="https://www.youtube.com/watch?v=S3FPvI5p8Zo" type="video/mp4">
</video>
I expect the video to show, but the actual result is it not working.
One way to do this is by using a cover photo and a link to youtube.com
<a target="_blank" href="https://www.youtube.com/watch?v=S3FPvI5p8Zo">
<img src="images/cover-image.jpg">
</a>
Another is to use jquery and fancybox (http://fancyapps.com/fancybox/3/) and create a pop up:
HTML:
<a id="fancybox-vid"></a>
JavaScript:
$('#fancybox-vid').click(function(e){
e.preventDefault();
$.fancybox({
href: "https://www.youtube.com/embed/S3FPvI5p8Zo?autoplay=1",
type: "iframe",
padding: 0,
helpers: {
overlay: {
locked: false
}
}
});
});
Besides embed tag, there are two more ways to upload a video in HTML:
1. object tag
2. iframe tag
Do you try it out?
<object width="425" height="344" data="https://www.youtube.com/embed/F9Bo89m2f6g"></object>
<iframe width="425" height="344" src="https://www.youtube.com/embed/F9Bo89m2f6g" frameborder="0" allowfullscreen></iframe>
These urls are links to a page which hosts the youtube video, not a direct link to the media content itself. It's my understanding that the video controls attribute would be for content you either host yourself or remote content that is a direct link, since you're instructing the browser to play the content on your page directly from that source. I don't think there is a way to do what you're trying to do without use of an iframe. Unless you'd like your website to try to download the media from youtube, name it, store it, and present it.
Another way to do this is by using Iframe tag and a link to youtube.com
<iframe width="560" height="315" src="https://www.youtube.com/embed/S3FPvI5p8Zo" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

Embed two online websites in one HTML page

I am trying to embed two websites in one page like YouTube and Google using div tags and the links in between the div tags....is there any way this could work?
You're looking for the <iframe> tag.
Try using Iframes with the links set to your desired pages
Generally the iframe-tag is used to embed whole websites. (see MDN article) But appearantly youtube & google have blocked that option. (see when running the snippet below)
<iframe
width="500"
height="100"
src="https://www.wikipedia.org">
</iframe>
<iframe
width="500"
height="100"
src="https://www.google.com">
</iframe>
<iframe
width="500"
height="100"
src="https://www.youtube.com">
</iframe>
Their is three types which I define to add any other website in your webpage.
Note: But nowadays Google, Facebook, and other lots of websites do not allow you to load their website or webpage on your Webpage for some security issues.
<iframe src="https://www.example.com" height="200" width="300"></iframe>
<object data="https://www.example.com" width="400" height="300" type="text/html">
Alternative Content
</object>
<embed src="https://www.example.com" width=200 height=200 onerror="alert('URL invalid !!');" />

Youtube Video not showing in a web page when embed using iframe?

I want to embed a Youtube video on my website. I have tried the following code but it does show the video or any controllers:
<iframe width="400" height="300"
src="https://www.youtube.com/watch?v=z-QgsXkYqjc"
frameborder="1"
allowfullscreen></iframe>
Anyone know what I am doing wrong?
Much appreciated.
Change the src to this:
src="https://www.youtube.com/embed/z-QgsXkYqjc"

html : iframe not showing content in html

I want to show a youtube video in html 4. For that, I am using iframe. But the content of iframe is not showing.
<iframe frameborder="1" width="420" height="345" src="https://www.youtube.com/watch?v=C8kSrkz8Hz8"></iframe>
FYI: I am using Firefox 29.0 and Chrome 35.0. Both browsers are showing the same result.
Change your src with //www.youtube.com/embed/C8kSrkz8Hz8
your code shoud look like this
<iframe frameborder="1" width="420" height="345" src="//www.youtube.com/embed/C8kSrkz8Hz8"></iframe>
Find code under each video on youtoube at Share menu.
When you try to put the whole YouTube page into an iframe, it sends a HTTP header called X-Frame-Options with the SAMEORIGIN value, which tells the browser, that the page can only be displayed in a frame on the same origin as the page itself.
You should use the provided embed code (you can find it below every YouTube video), which is also an iframe, but with a different URL. It will only show the player.
In this case, the embed code would be:
<iframe width="560" height="315" src="//www.youtube.com/embed/C8kSrkz8Hz8" frameborder="0" allowfullscreen></iframe>
replace you Iframe with this one. this works for you.
<iframe width="640" height="390" src="//www.youtube.com/embed/C8kSrkz8Hz8" frameborder="0" allowfullscreen></iframe>
missing attributes are: frameborder="0", allowfullscreen
You should change the youtube URL to remove the "s" so it looks like this:
<iframe width="420" height="345" src="//www.youtube.com/embed/C8kSrkz8Hz8" frameborder="1" allowfullscreen></iframe>
You should also be able to embed a youtube video from the page. Please see the screenshot attached:
I tried it this way and worked for me. Changing your src="https://www.youtube.com/embed/C8kSrkz8Hz8"
following the other parameters.

html5 can't embed youtube video

I'm using Aptana studio 3, and i'm trying to embed a Youtube video. I've watched three Youtube tutorials all showing me the same method. But when I load the web page I get "the file or directory could not be found." where the video should be.
<div class ="center">
<iframe width="420" height="315" src="//www.youtube.com/embed/JijNVImAGSc" frameborder="0" allowfullscreen></iframe>
</div>
The class "center" is just,
.center{
text-align: center;
}
I've tried this with multiple videos with the same outcome.
Also i'm getting a warning symbol and it says "iframe proprietary attribute "allowfullscreen". I'm not sure if that helps but I tried to remove that section of code once and it did not help.
Please change the src attribute to src="http://www.youtube.com/embed/JijNVImAGSc"
YouTube iFrame
<iframe width="420" height="345"
src="http://www.youtube.com/embed/XGSy3_Czz8k">
</iframe>
YouTube Embedded
<embed
width="420" height="345"
src="http://www.youtube.com/v/XGSy3_Czz8k"
type="application/x-shockwave-flash">
</embed>