javascriptjspinternet-explorer-11showmodaldialog

showModalDialog - IE11 ignores dialogHeight and dialogWidth


I am experiencing a problem whith showModalDialog on IE11. The dialog window works fine, but ignores the width and height parameters. The dialog opens in a very small window and the user needs to resize it.

I know that this function is deprecated in Chrome and I know other options like jQuery-UI dialog, but I want to know if it is possible to fix this problem for IE11 using showModalDialog.

js code:

var url = "/xxWar/xxModal.jsp?title=xx&frameUrl=/xxWar/xxServlet%3Faction%3Dxx";
var value = showModalDialog(url, init, "dialogWidth:" + width + "px;dialogHeight:" + height + "px;resizable:yes;status:no;scroll:yes;help:no");

and the xxModal.jsp:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <title><%=request.getParameter("title")%></title>
    </head>
    <frameset rows="0,*" frameborder="no" border="0" framespacing="0">
        <frame src="" name="header">
        <frame src="<%=request.getParameter("frameUrl")%>" name="main" id="main">
    </frameset>
    <noframes>
        <body>
        </body>
    </noframes>
</html>

Thank you!


Solution

  • I fixed the problem adding this line <meta http-equiv="X-UA-Compatible" content="IE=7"> inside de modal.jsp:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
    <html>
        <head>
            <meta http-equiv="X-UA-Compatible" content="IE=7"> 
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
            <title><%=request.getParameter("title")%></title>
        </head>
        <frameset rows="0,*" frameborder="no" border="0" framespacing="0">
            <frame src="" name="header">
            <frame src="<%=request.getParameter("frameUrl")%>" name="main" id="main">
        </frameset>
        <noframes>
            <body>
            </body>
        </noframes>
    </html>