SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jun 2006
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Object Detection

    I've built a flash-communication based javascript function which makes use of two horizontal frames (html frames, not flash movie frames).

    I only want to allow browsers which can execute the developed script to enter my site.

    In the upper frame of my site is a) the flash document which is being "communicated" with and b) the javascript function code, which reads as follows:

    <script language="JavaScript">
    function reSet(target,frameNumber)
    {
    navigation.TCallFrame(target,frameNumber);
    }
    </script>

    The actions above are executed via an html link in the lower frame of my website, as follows:

    <a href="audio.html?peanutbutterfly" target="hidden" onClick="parent.frames[0].reSet('/',3)">Peanut Butter Fly</a>

    If this script won't work in a given browser, I want them to be redirected to another page. I want to use object detection to do this. How should I go about it?

    One of my concerns is that many browsers can easily handle "navigation.TCallFrame(target,frameNumber);"

    ... but ...

    because it's being communicated from one frame to another, I've discovered that many browsers CANNOT handle it.

    Examples: Netscape for Windows works but Netscape for Mac doesn't. Explorer for Windows works but Explorer for Mac doesn't. Later versions of Safari work but earlier versions do not ... you get the picture.

    I'm uncertain as to how to begin testing this and am in need of advice.

    Thanks in advance.

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For more recent versions of javascript you can use try...catch to wrap your "dangerous" function calls, for example:

    <script>
    try {
    callDangerousFunc();
    } catch(e) {
    alert("your browser sucks");
    }
    </script>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •