If you have a website being compatible with Edge/Chrome and in past it was only compatible with IE 11 and if you are using window.showModalDailog in your JavaScript code, then it will not work in modern browsers. Let’s check below its solution.

Below given sample JavaScript code that will not work because of showModalDailog in its code.

function openCalendar(oDate){
    if (typeof jQuery != 'undefined' && oDate instanceof jQuery) {
        var dateValue   = oDate.val();
        var color       = oDate.css('color');
    }else{
        var dateValue   = oDate.value;
        var color       = oDate.style.color;
    }

  var month     = "";
  var year      = "";

    if (dateValue != "" && color != "red") {
        month = dateValue.substring(3,5);
        year  = dateValue.substring(6,10);
    }
  search    = window.showModalDailog('../calendar/calendar.jsp?month='+month+'&year='+year ,null,'dialogWidth=220px;dialogHeight=220px;STATUS:NO;SCROLL:NO;help:no');

  if (search != null && search != "undefined" && search != "") {
        if (typeof jQuery != 'undefined' && oDate instanceof jQuery) {
            oDate.val(search);
            oDate.css('color', "");
        }
        else {
            oDate.value           = search;
            oDate.style.color   = "";
            oDate.className   = "InputText";
        }
  }
}

Solution:

As an alternative, we can try to use Window.Open() (for Edge and Chrome browsers). You can check below code it will definitely solve given issue.

function ShowInfoBox(message) {

        var ie = document.all;
        varl url = '../TestWeb/Error/ErrorMessages/PopInfoUI.aspx?val=' + message
 

        if(ie){
              window.showModalDialog(url, 'window', 'status:no; help:no; dialogWidth:400px; dialogHeight:120px');
             }       
       else {
            var theWin = window.open(url, 'New Window', 'width=400, height=120, status=no');
            theWin.focus();
           }
    }

Comments are closed.

Explore More

On click of parent page pop up window should stay on top only

To ensure the popup window stays on top of the parent page, you can use the window.open() method with specific focus-handling logic. JavaScript allows you to bring the popup window

Open a Fixed-Size Popup Without Minimize/Maximize Effects

Disabling the minimize and maximize buttons of a popup window is not directly supported in modern browsers, including Microsoft Edge, due to security and user-experience considerations. The window.open() function provides

JavaScript method to remove child node

Create a JavaScript method that will take 2 parameters, first parameter will take complete XML as string and second will take XML node object which need to be removed from