Thursday, 12 September 2013

Best way to detect field value change that was caused by chrome content script

Best way to detect field value change that was caused by chrome content
script

I am writing a chrome plugin that makes use of a website (which I am also
writing myself) to interact with the user.
A content script in the plugin changes certain field values in the website
using jQueries .val() method.
The website needs to be able to detect such a change via its own
javascript in order to update other stuff accordingly.
However, the value change does not fire a onchange event and since the
website js and the content script are independent, the element.change()
function in the websites jQuery does not react when the event is fired
from code in the content script.
What is the best way to make the website js detect a change in the value
of the field?
PS: In case you consider this a design problem (communication between
extension and website is mixed with display functionality) I would also be
interested in your suggestion.

No comments:

Post a Comment