There is a lot of information on this issue to be found in the forums
at http://www.dashboardwidgets.com
Also, escape is depreciated in JavaScript 1.5. Instead, encodeURI and
encodeURIComponent should be used.
Cheers,
Chris
On 5/19/05, Marc Tremblay <email@hidden> wrote:
> Hi everybody,
>
> I'm having some problems with openURL and URLs with escaped
> characters. The code I'm using is below.
>
> <html>
> <head>
>
> <script language="javascript">
> function doSearch(field, event) {
> if (field.value && (field.value.length > 0)) {
> openURL('http://www.google.com/search?q=' + escape
> (field.value));
> }
> }
>
> function openURL(url) {
> if (window.widget) {
> widget.openURL(url);
> }
> else {
> window.location.href = url;
> }
> }
> </script>
>
> </head>
>
> <body>
>
> <div id="front" style="background: white; width: 100%; height:
> 100%;">
> <table border="0">
> <tbody>
> <tr>
> <td>http://www.google.com/search?q=</td>
> <td><input id="searchField" type="search" size="20"
> onsearch='doSearch(this, event);' results /></td>
> </tr>
> </tbody>
> </table>
> </div>
>
> </body>
>
> </html>
>
> My problem is that when field.value contains characters that should
> be escaped (' ', å, etc.), hitting enter on the search field does
> nothing. No Safari window, no log entry. The code works fine for
> non-escaped words (dog, cat, etc...). Also, the code works fine for
> any word (escaped or no) if run directly in Safari, it's only when
> the code is run in Dashboard that my problems show up.
>
> What am I missing?
>
> Thanks.
>
> Marc _______________________________________________
> 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
>
_______________________________________________
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