I don't think it's possible to access variables directly.
You can send a value from C2 to the webpage using window.postMessage() method.
Or you can make a C2 function that returns the value, and call it from the webpage using c2_callFunction("function_name").
However, I never tried this, not sure if these methods will work.