[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 703
  • Last Modified:

Change window.open to showModalDialog?

Use a spelling app that opens using window.open, checks and help correct the spelling in a text box and then closes.  Want to be able to change how this opens, from a window.open link to a showModalDialog link.  Is this possible?

Current window.open code:

<textarea name="MyTextArea" cols="50" rows="7" id="MyTextArea">Ths iz a tezt sampl. </textarea>
<a title="Spell Check" href="#"  onClick="window.open('/ASPSpellCheck/ASPSpellCheck.asp?fields=MyTextArea','aspSpellWin','width=460, height=290, scrollbars=no');return false;" ><img src="/ASPSpellCheck/Assets/spellicon.gif" style="cursor:pointer"   alt="Spell Check" border="0" ></a>


Had a go at using showModalDialog, the window opens but hangs. Presume that there is an parameter that is not being passed:
<textarea name="MyTextArea" cols="50" rows="7" id="MyTextArea">Ths iz a tezt sampl. </textarea>
<a title="Spell Check" href="#"  onClick="window.showModalDialog('/ASPSpellCheck/ASPSpellCheck.asp?fields=MyTextArea','aspSpellWin','dialogWidth:460px;dialogHeight:290px');" ><img src="/ASPSpellCheck/Assets/spellicon.gif" style="cursor:pointer"   alt="Spell Check" border="0" ></a>

Anyone got any ideas?
0
daimo1
Asked:
daimo1
  • 2
  • 2
1 Solution
 
KyanarCommented:
First question before I move forward on this: do you intend for people using browsers other than Internet Explorer to use your web page?  If so, then showModalDialog is not for you, as it is a feature implemented only by Microsoft browsers, and window.open is the function you should use.
0
 
daimo1Author Commented:
Hi Kyanar

Happy with IE only.  

D
0
 
KyanarCommented:
OK, first things first, you do not need that second parameter - unlike in window.open, that is the special dialog parameters to hand to the javascript of the popup (for future reference when using window.showModalDialog)

Second up, modal dialogs don't have as much access to the DOM and API as a regular popup does.  First thing I note is that the ASP spell check system has a "Processing" wait screen while it works, then it redirects you off to it's actual scripts to perform the spell check.  Unfortunately, a dialog opened with showModalDialog is not actually allowed to do this, probably due to the risk of XSS exploits making it too dangerous to allow.

So, regretfully, I must inform you that what you are attempting to do is not possible with the showModalDialog method (I tore my hair out attempting to do this with a complex online data entry application - eventually gave up and removed all showModalDialog references from the script)
0
 
daimo1Author Commented:
Not what I wanted to hear but at least i won't waste anymore time trying.

Thanks for you help Kyanar.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now