Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do i load a view(cshtml) into an iframe?

I'm trying to load a view into an iframe in another(parent) view using javascript and razor.

I'v tried setting the iframe's src to this var url = '@Url.Action("myaction", "MyController")';

and this: var url = '@Href("~/myform.cshtml")'; without success.

Thanks

Thanks

like image 688
sirbombay Avatar asked Sep 30 '13 12:09

sirbombay


People also ask

Can we load HTML in iframe?

The HTML <iframe> tag specifies an inline frame. An inline frame is used to embed another document within the current HTML document.

Does iframe block page load?

Definitely iframe affects the page load performance and also it is not recommended to use iframe for many page security issues perspective.

How do I open an iframe URL?

To navigate URL in iframe with JavaScript, we have to set the src attribute or return the value of src attribute in an iframe element. The src attribute defines the URL of document that can be shown in an iframe. Absolute URL: It points to another website (For example: https://www.geeksforgeeks.org/c-plus-plus/).


1 Answers

If you are using razor engine.

<iframe src = '@Url.Action("myaction", "myController")' width = "100%" 
    height="1000" frameBorder="0"></iframe>
like image 156
Satpal Avatar answered Sep 27 '22 23:09

Satpal