Recent Widgets


Register for DashboardWidgets

Recent Forums Posts

Partners


iCompositions

MacDesktops.net

RSS Showcase
RSS Comments
RSS Forums

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. Posted in: Widget Development

Widget send data to Safari

Author Message
wish1267



Joined: 12 Jan 2010
Posts: 4

Posted: Tue Jan 12, 2010 - 3:14 pm    Post subject: Widget send data to Safari Reply with quote

Can a widget collect some data, say the current time, and send it to an open website in safari? for example, say I have Google open, I use my widget, and it sends the time to the search field in Google...yes?no?
View user's profile Send private message Send e-mail Widgets
marcintosh



Joined: 09 Apr 2006
Posts: 20

Posted: Mon Jan 25, 2010 - 12:12 pm    Post subject: Reply with quote

The Google widget doesn't work the way you think. The user types in a search term and the widget tacks that term onto Google's search URL and sends the whole URL to Safari (or your default browser).

For example, if I type "dashboard" into the Google widget, the widget inserts my search term into this javascript

Code:
var url = "http://www.google.com/search?q=" + value + "&ie=UTF-8&oe=UTF-8";

to get

Code:
var url = "http://www.google.com/search?q=dashboard&ie=UTF-8&oe=UTF-8";

So the widget isn't sending data to a specific site, it's sending a specific site to the browser.

If you go to the site you're working with and type in the sort of data you'd like to send, you should get the full URL of the results page with the search term included. You should be able to use that to build the javascript you need.
View user's profile Send private message Send e-mail Widgets
wish1267



Joined: 12 Jan 2010
Posts: 4

Posted: Mon Jan 25, 2010 - 12:17 pm    Post subject: Reply with quote

Hello, thanks for the reply. I am asking a different question. "Can a widget autofill a safari textfield". Say my widge that I develop has a databse with Username & password. Can I bring up my widget at the login of yahoo-mail or gmail or even my bank account website and autofill those fields ?
View user's profile Send private message Send e-mail Widgets
Hawkman



Joined: 12 Jun 2005
Posts: 28
Location: Derby, UK

Posted: Mon Jan 25, 2010 - 9:15 pm    Post subject: Reply with quote

Well... You could write an Applescript for the widget to call, which runs some Javascript in Safari...
View user's profile Send private message Send e-mail Visit poster's website AIM Address Widgets
marcintosh



Joined: 09 Apr 2006
Posts: 20

Posted: Thu Jan 28, 2010 - 7:58 am    Post subject: Reply with quote

I agree with Hawkman, this is easier to implement in AppleScript. I'm not familiar with how to add an AppleScript to a widget, but I know it can be done.

Of course, the latest version of Safari has auto fill and there are some great auto fill plug-ins for Firefox, so a widget may be redundant.

I would also recommend 1Password from Agile Solutions.
View user's profile Send private message Send e-mail Widgets
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

 
Powered by phpBB © 2001, 2002 phpBB Group