I have a requirement of just surfing through the net in my asp application and for that purpose i dropped an iframe.
But after that i found that certain sites likes google,fb,youtube etc wont open up in iframe due to security concerns.
After some discussions with my colleagues, i thought of a solution of displaying the web page(just like iframe) in a div and then displaying that div in a modal pop up,in which the user can navigate to any pages within that modal pop up
But after some initial searching ,i havent found anything where i can start towards my aim.So, i thought of asking it here.
Can anyone guide me to a proper direction to help me achieve my aim.Any help will be appreciated.
Thanks
Look at this example:
$('#btnShowModal').click(function () {
$.post
(
'MyController',
{
some parameters to pass
},
function (htmlResult) {
$('#dialogWindowContent').html('');
$('#dialogWindow').dialog(
{
title: 'Title',
autoopen: true,
width: 'auto',
//height: 180,
resizable: false,
modal: true,
draggable: false
});
$(window).resize(function () {
$("#dialogWindow").dialog("option", "position", "center");
});
//position of modalWindow will always be in center of your browser window
$('#dialogWindowContent').append(htmlResult);
$("#dialogWindow").dialog("option", "position", "center");
});
return false;
});
It's my button and div to modal window:
<input type="button" value="Add theme" id="btnShowModal" />
<div id="dialogWindow">
<div id="dialogWindowContent">
</div>
</div>
I wrote it to my MVC application. And as understand, you should only rewrite post-method. As htmlResult
you can return any html code and it will be shown in your modal window.
I hope, it will be usefull for you.