IFrame的替代方案 [英] Alternative of IFrame
问题描述
您好,
网址来自数据库,我必须显示该网址,现在我正在使用IFrame,还有其他替代方案吗...请帮忙我出去
Ex: -
searchHolder是我的< asp:PlaceHolder id =searchHolderrunat =server/>
String strurlNew =http://www.xyz.com;
HtmlGenericControl searchFrame = new HtmlGenericControl(iframe);
searchFrame.ID =searchFrame+ Convert。 ToString(i);
searchFrame.Attributes.Add(height,strHeight);
searchFrame.Attributes.Add(width,strWidth);
searchFrame.Attributes.Add(src,strurlNew);
searchHolder.Controls.Add(searchFrame);
谢谢提前,
Shubhranshu
Hello,
URL are coming from DB, and I have to show that page of that URL, right now i am using IFrame for that, is there any other alternative for this.. please help me out.
Ex:-
searchHolder is my <asp:PlaceHolder id="searchHolder" runat="server" />
String strurlNew="http://www.xyz.com";
HtmlGenericControl searchFrame = new HtmlGenericControl("iframe");
searchFrame.ID = "searchFrame" + Convert.ToString(i);
searchFrame.Attributes.Add("height", strHeight);
searchFrame.Attributes.Add("width", strWidth);
searchFrame.Attributes.Add("src", strurlNew);
searchHolder.Controls.Add(searchFrame);
Thanks is advance,
Shubhranshu
推荐答案
嗨Shubhranshu,
另一个不错的解决方案是使用客户端 Javascript 在后台创建 HTTP请求,然后将响应填充到您网页上的元素中,在客户端。
请参阅此JS示例,了解如何创建 HTTP请求
Hi Shubhranshu,
One other nice solution for you is to use client side Javascript to create the HTTP Request on the background and then fill the response into elements on your web page, on the client side.
See this JS example of how to create an HTTP Request
function httpGet(theUrl)
{
var xmlHttp = null;
xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", theUrl, false );
xmlHttp.send( null );
return xmlHttp.responseText;
}
干杯,
Edo
Cheers,
Edo
这篇关于IFrame的替代方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!