Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Custom JavaScript functions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom JavaScript functions



On Wednesday, July 23, 2003, at 05:38 AM, Phillip Mills wrote:

On Tuesday, July 22, 2003, at 11:41 AM, Darin Adler wrote:

On Tuesday, July 22, 2003, at 06:00  AM, Ronald Jaramillo wrote:

- (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message;

Now you can send a message from javascript to your app by using <a href="javascript:alert('hello there')">Hello</a> in your HTML page. Of course this will trap all java script alert messages. You could use a prefix to diference the messages intended to your app and those for the users fx. " alert('#app# Hello world')" .

We've been suggesting this kind of workaround for people who need this feature with today's Web Kit, and many people have had really great results with this technique. Try it out and let us know how it works for you.

Thanks for the tip. This might work if I'm able to install a filter that can rewrite the HTML pages before the JavaScript engine gets them. The filter would find function calls that work on platform "Z" and put a javascript:alert() envelope around them. I'll keep experimenting.

Another idea is to actually define the objects and functions that are needed. You can construct a suitable function definition and call stringByEvaluatingJavaScript: to add that function to the document. If the function has the right name and then calls alert with the appropriate parameters, then it might work. I haven't tried this yet.


    --  Darin
_______________________________________________
webkitsdk-dev mailing list | email@hidden
Help/Unsubscribe: http://www.lists.apple.com/mailman/listinfo/webkitsdk-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Custom JavaScript functions (From: Phillip Mills <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.