IE浏览器中的java脚本错误 [英] java Script error in IE browser

查看:507
本文介绍了IE浏览器中的java脚本错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮我解决以下错误...



我使用以下代码进行确认并指向某个页面。当我点击数据网格中的链接时。这是我的代码..

 hdnMakerName.Value = e.Item.Cells [ 5 ]。的ToString(); 
会话[ Expn_ID] = e.Item.Cells [ 0 ] Text.Trim();
lnkCreateExpn.Attributes.Add( onclick 返回ConfirmRedirect(' + TempString + '););

if true
{

Response.Write( < script language = javascript type = text / javascript> window.opener.location。 HREF = 'CreateException.aspx'; self.close();< /脚本>中);
// Response.Redirect(CreateException.aspx,false);
}
else
{
// 返回false;
}



当我在Crome中运行此代码时,它工作正常,但在我使用时IE浏览器正在跟踪错误..

 Microsoft JScript运行时错误:'  window.opener.location'   null 或不是 object  



Plz帮我解决这个问题。

解决方案

< blockquote>由于安全限制,IE不支持此功能。

请参阅 - window.opener [ ^ ]。

Quote:

如果当前窗口没有开启器,则此方法返回NULL。 Windows Phone浏览器不支持window.opener。如果开启者位于不同的安全区域,IE也不支持它。



仍然可以在IE中自定义,参考 - 对象window.opener.location.href是在IE8中出现故障 [ ^ ]。


Please Help me in solving the below error...

I am using the following code for Confirming and direct to some page. when i click on link in the data gird. here is my code..

hdnMakerName.Value = e.Item.Cells[5].Text.ToString();  
Session["Expn_ID"] = e.Item.Cells[0].Text.Trim();
lnkCreateExpn.Attributes.Add("onclick","return ConfirmRedirect('" + TempString + "');");

if(true)
{

    Response.Write("<script language=javascript type=text/javascript>window.opener.location.href='CreateException.aspx';self.close();</script>");
    //Response.Redirect("CreateException.aspx",false);
}
else
{
    //return false;
}


when i am running this code in Crome it is working fine but When I am using IE it is schowing following error..

Microsoft JScript runtime error: 'window.opener.location' is null or not an object


Plz Help me to solve this problem.

解决方案

This is not supported in IE due to security restrictions.
Refer - window.opener[^].

Quote:

If the current window has no opener, this method returns NULL. Windows Phone browser does not support window.opener. It is also not supported in IE if the opener is in a different security zone.


Still you can customize this in IE, refer - Object window.opener.location.href is malfunctioning in IE8[^].


这篇关于IE浏览器中的java脚本错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆