irt.org Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt

Q1148 Is it possible to detect for the support of object methods in the same way you can detect for the support of objects?

You are here: irt.org | FAQ | JavaScript | Object | Q1148 [ previous next ]

It would be nice if you could. But IIRC it can't be done on Internet Explorer 3 - it doesn't like you testing for object methods that actually exist. The following code shows how you would test for objects, methods and properties:

<script language="JavaScript"><!--
if (document.images)
    document.write('Image object supported<br>');
else
    document.write('Image object is not supported<br>');

if (window.open)
    document.write('Window open method supported<br>');
else
    document.write('Window open method not supported<br>');

if (window.location)
    document.write('Window location propert supported<br>');
else
    document.write('Window location propert not supported<br>');

if (window.bogusname)
    document.write('Window bogusname object/method/property supported<br>');
else
    document.write('Window bogusname object/method/property not supported<br>');
//--></script>

©2013 Martin Webb

ArticlesFAQsGamesFeedback

FOLDOCRFCsInstant JavaScriptSoftwareBooksJavaScript Programmer's ReferenceAboutTop