在asp.net中打开div内的网页 [英] Opening web pages inside a div in asp.net
问题描述
我需要在我的asp应用程序中浏览网页,为此我删除了一个iframe。
I have a requirement of just surfing through the net in my asp application and for that purpose i dropped an iframe.
但之后我发现某些网站喜欢由于安全问题,google,fb,youtube等不会在iframe中打开。
But after that i found that certain sites likes google,fb,youtube etc wont open up in iframe due to security concerns.
在与同事讨论之后,我想到了显示网页的解决方案(只是像div中的iframe,然后在模态弹出窗口中显示该div,用户可以在其中导航到该模态弹出窗口中的任何页面
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.
谢谢
推荐答案
看看这个例子:
$('#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;
});
这是我的按钮和div到模态窗口:
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>
我把它写入我的MVC应用程序。理解,你应该只重写post-method。如 htmlResult
,您可以返回任何HTML代码,它将显示在您的模态窗口中。
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.
我希望,它对你有用。
这篇关于在asp.net中打开div内的网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!