473,386 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Check for showModalDialog support

Just want a verification of logic. This seems to work for IE and
Firefox, but I wonder if it would be a problematic test in any of the
other latest browsers? Is the use of the "window" object correct? I
didn't think it would be document.showModalDialog.

if(window.showModalDialog){
//do something
}
else
{
//do something else
}

Thanks, John

Feb 8 '06 #1
3 3069
johkar said the following on 2/8/2006 8:47 AM:
Just want a verification of logic. This seems to work for IE and
Firefox, but I wonder if it would be a problematic test in any of the
other latest browsers? Is the use of the "window" object correct?
What does the documentation say?
I didn't think it would be document.showModalDialog.


It won't.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 8 '06 #2
johkar wrote:
Just want a verification of logic. This seems to work for IE and
Firefox, but I wonder if it would be a problematic test in any of the
other latest browsers?
You only test for the existence and true-value of the property, not if it is
a method. That /is/ problematic, for another DOM could pose as IE DOM and
a call on this property could result in a TypeError.
Is the use of the "window" object correct?
It is, RTFM. showModalDialog is a method of Window objects in the IE DOM.

<URL:http://www.google.com/search?hl=en&q=showModalDialog&btnI=I%27m+Feeling+ Lucky>
I didn't think it would be document.showModalDialog.
It is not.
if(window.showModalDialog){
//do something
}
else
{
//do something else
}


function isMethodType(s)
{
return (s == "function" || s == "object");
}

if (typeof window != "undefined"
&& isMethodType(typeof window.showModalDialog))
{
// do something _with showModalDialog_
}
else
{
// do something else
}
PointedEars
Feb 9 '06 #3
Thanks for the info.

Feb 22 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Simon Storr | last post by:
Is it possible to make the parent window refresh when a modal dialog is closed? I know I can use window.opener.location.reload(true); for a 'normal' window, but this doesn't work for...
3
by: PeeBee | last post by:
I have researched the issue of setting the title of a window created with a call to showModalDialog. I have found numerous articles, but nothing that answers my particular case (Code abbreviated...
2
by: Perry van Kuppeveld | last post by:
Hi, When i'm using the ShowModalDialog function, while another browser window is open (not the application window calling the showmodaldialog) i lose my session. What could be the problem /...
4
by: MW de Jager | last post by:
I want to call ShowModalDialog(...) from my C# code in the code behind page of my aspx page. I do not want to link this to a button, since I want to first do some checking myself before I call the...
1
by: elizayiu | last post by:
Hi, I need to write a webpage which does the following: - open up a window and pass parameters into it (i.e. need to call showModalDialog() or showModelessDialog()) - contains jscript to...
1
by: itc_sburnett | last post by:
I am trying to build a simple help system. I cant seem to get the ShowModalDialog to actually jump to the correct location. Why doesn't the following open the page to correct position? ...
6
by: David | last post by:
Hi all, I am opening a webform with showModalDialog. This appears to pop-up fine, though I have a problem... Inside the webform is a treeview control. When the treeview is populated, I am...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.