Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iframe link to open Safari



thanks for replying.

I tried testing & using just widget inside the iframe source
but couldn't get it to work. it seems that the widget object is not accessible from inside the iframe's context.


function wclick(link) {
    if (widget) {
        widget.openURL(link.href);


I reason I had used if (window.widget) is that I had seen that code in several places in the Dashboard Tutorial. though the openURL example does a plain if (widget) test.

a related question is that to write dashboard code that allows testing in Safari, what's the recommended way to test since my understanding is that an undefined variable in JS isn't the same as null. e.g. (typeof(widget) != "undefined") ?


Steve



On Jun 12, 2005, at 3:03 PM, email@hidden wrote:

Date: Sun, 12 Jun 2005 11:21:33 -0700
From: Christian <email@hidden>
Subject: Re: iframe link to open Safari
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=WINDOWS-1252; delsp=yes;
    format=flowed

You don't need the "window.xxx."—the call is simply widget.openURL
(url).  The widget object that the Dashboard runtime injects into the
web view is independent of the DOM, so you don't have to trace back
to it, provide a path, etc.

On Jun 12, 2005, at 2:44 AM, Steve Weyer wrote:

I have a similar situation in 10.4.1.   I display one of two pages
in an iframe -- both come from a server that I control. one is PHP;
the other is vanilla HTML.

 I can use  "if (window.widget) window.widget.openURL(...)" in the
main window of my widget it works fine -- opens a Safari window

however, if I set up a script within an iframe to open a link,
window.widget fails.  so does window.top.widget and
window.parent.widget.

// in iframe
function wclick(link) {
    if (window.top && window.top.widget) {
        window.top.widget.openURL(link.href);
        return false;
    };
    link.target = "_top";
    return true;
}
...
<A href="some link" onClick="return wclick(this)">

clicking on the link works fine in Safari (i.e., displays link in
main window, not the iframe)
but widget displays in "_top" also -- doesn't use openURL.

if window.top isn't the correct way to access main window, what is?
or other workaround?

or is this a bug in current widget?  or somehow considered a
security hole?

Steve

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/email@hidden

This email sent to email@hidden





------------------------------

_______________________________________________
Dashboard-dev mailing list
email@hidden
http://lists.apple.com/mailman/listinfo/dashboard-dev


End of Dashboard-dev Digest, Vol 2, Issue 11 ********************************************


_______________________________________________ Do not post admin requests to the list. They will be ignored. Dashboard-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/dashboard-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.