Click here to Skip to main content
12,950,832 members (59,277 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi

Following code is working fine in following browser:

  • IF

  • Mozilla

  • Safari


but it is not working in
  • Google Chrome 5.0.3

var returnValue = window.showModalDialog("popup.aspx?", "window", "dialogWidth:390px;dialogHeight:180px;scroll:no;");
    }


Your answer will be appreciated!

Thanks,
Imdadhusen
Posted 20-Sep-10 22:39pm
Comments
Svetlin Panayotov 21-Sep-10 7:15am
   
Sadly, yes. Last time I tried using showModalDialog it worked in Chrome, but the same way window.open works - the window was not modal. It won't work in Opera as well, so the only thing that comes to mind is using Jquery UI's Dialog.
sukanta kumar mangal 8-Jan-14 3:56am
   
yes i have also tried it in one of my project .it will work..
Sandeep Mewara 21-Sep-10 13:41pm
   
Try jQuery dialogs...
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

I found Google has (had) some issues with the showModalDialog. You can follow the status of the problem right here[^].

Good luck!
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Hi,

window.showModalDialog() is not working properly on Google Chrome, this is why you have 3 options here:
1) Put onblur="this.focus()" in the body element of the target page and put a div which will prevent user from clicking on the opener page
2) Use Modal Dialog from jQuery, I have implemented a jQuery function which will give you the possibility to pass arguments to the target page, to close the dialog using window.close() and to return retunrValue
My Article: http://extremedev.blogspot.com/2011/03/windowshowmodaldialog-cross-browser-new.html[^]
3) Do not use Chrome, which I think that is not the best solution.

Good luck!
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

Hi,

You are right window.showModalDialog() doesn't work with the latest updated version of Google Chrome, i too faced this problem in my project.

You can have a number of solutions for that :-

1. The easiest one is window.open();

Pros:- Easy to handle and use.
Cons:- You can still work on the parent page while the pop-up window is opened.

2. The Efficient solution is to use jQuery dialog control.
For better understanding of jQuery dialog control you can refer the
link "http://jqueryui.com/dialog/[^]"


Thanks.
  Permalink  
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

i do it one of my project .it will work .i think theire might be some issue..try again

window.showModalDialog("popup.aspx?", true, 'dialogHeight:150px;dialogWidth:500px');
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 5,984
CHill60 3,460
Maciej Los 3,053
Jochen Arndt 1,975
ppolymorphe 1,820


Advertise | Privacy | Mobile
Web01 | 2.8.170525.1 | Last Updated 20 Oct 2014
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100