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
The HTML <iframe> tag specifies an inline frame. An inline frame is used to embed another document within the current HTML document.
Definitely iframe affects the page load performance and also it is not recommended to use iframe for many page security issues perspective.
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/).
If you are using razor engine.
<iframe src = '@Url.Action("myaction", "myController")' width = "100%"
height="1000" frameBorder="0"></iframe>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With