• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Run Javascript Function From Objective-C.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Run Javascript Function From Objective-C.


  • Subject: Re: Run Javascript Function From Objective-C.
  • From: Izidor Jerebic <email@hidden>
  • Date: Mon, 28 Sep 2009 13:21:40 +0200


On 28.9.2009, at 13:07, Philip Juel Borges wrote:

The above code should work if you have all connections set up correctly.

The method is connected to the textfield. So that should be in order.

The simplest way to debug is to just print out what is happening and check your debug/run console for output. Put this in your methods and see what happens when you press enter/return in your textfield:

NSLog( @"theWebView = %@, sender = %@, stringValue = %@", theWebView, sender, [sender stringValue] ) ;

That line of code return this:

The Debugger has exited with status 0.
[Session started at 2009-09-28 12:45:47 +0200.]
2009-09-28 12:45:49.983 CallJS[2059:10b] theWebView = <WebView: 0x1249a0>, sender = <NSTextField: 0x1290a0>, stringValue = 24


It seems that it just returns the value I enter in the textfield. My test.html file is bundled in my Resource folder so I don't get why the action wont work with it. Maybe it's not possible this way.


The next step is to check if your javascript function is called (maybe your page has some syntax errors and the function is not even defined).

Try doing something obvious in your javascript function, such as changing text color to red, or something. If that works, then you should use some other approach for scrolling, e.g. use scrollTo() or some of its derivatives. But that is general JavaScript and not Cocoa problem any more...


izidor

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Run Javascript Function From Objective-C. (From: Philip Juel Borges <email@hidden>)
 >Re: Run Javascript Function From Objective-C. (From: Izidor Jerebic <email@hidden>)
 >Re: Run Javascript Function From Objective-C. (From: Izidor Jerebic <email@hidden>)

  • Prev by Date: Animating "contents" property of CALayer via the delegate
  • Next by Date: Re: One-liner to check existence of image
  • Previous by thread: Re: Run Javascript Function From Objective-C.
  • Next by thread: Re: Run Javascript Function From Objective-C.
  • Index(es):
    • Date
    • Thread