首页 > 解决方案 > asp.net 和弹出窗口停止使用 Chrome

问题描述

非常简单的代码,但很难找到其他可行的方法:

        Private Sub Page_Load(ByVal sender as System.Object, ByVal e as System.EventArgs) Handles MyBase.Init
            If Not Me.IsPostBack Then
                'bunch of code here
            Else

                        Dim strUrl As String = "Alarm.aspx?ID=" & myAlarm.Rows(0).Item(0)
                        ClientScript.RegisterStartupScript(GetType(Page), "Alarm", "<script language='javascript'>window.showModalDialog('" & strUrl & "',null,'dialogWidth=460px;dialogHeight=310px;status=no;resizable=yes;');document.frmAutolog.submit();</script>")

                    End If
                Else

该代码在 IE 中运行良好,并且直到最近在 Chrome 中运行良好。

我尝试使用以下内容,但无法正常工作:

   Dim pop as string = "window.open('" & strUrl & "', 'popup_window', 'dialogWidth=460px,dialogHeight=310px,status=no,resizable=yes');"
   ClientScript.RegisterStartupScript(Me.GetType(),"script", pop, True) 

页面本身有很多代码,这个版本的弹出窗口只会在手动刷新屏幕后发生,而不是在从提交按钮回发后立即发生(就像原来的 IE 和 Chrome 一样)。

背景:数据输入到这个页面,如果数据超出范围,那么提交后会立即弹出

标签: asp.netvb.netgoogle-chrome

解决方案


推荐阅读