I’m looking at some gadgets for automation. They offer various analog and digital data sampling and control. They host web pages in which one can embed comments containing private codes for controlling the device ala
<!-- (READ X) -->
The gadget replaces the comment with the value of X so by sprinkling these comments in the html, one can incorporate the data values in the html.
My question is this: Is there some way I could capture the value X in a javascript variable on a system external to the gadget?
I can add html and css scripts to the gadget.
These are the comment nodes — you can access them as regular DOM nodes. But watch out for browser incompatibilities.
var div = document.createElement('div'); div.innerHTML = "<!-- (READ X) -->"; div.childNodes[0].data; // returns (READ X)Read this article — it’s a jQuery plugin.