after my previous problem i’m trying to access javascript values that should be in the dom.
i actually want to access the browser url (to get the location of the p3d file)
neighter of my approaches work:
print base.appRunner.dom.window.location.hostname
print base.appRunner.dom.location.hostname
# just to check if i get anything at all
print base.appRunner.dom.document.getElementById('title')
if i understand javascript and panda’s access to it correctly this should be possible without any javascript in the html. is this correct?
Which is, in fact, the correct results. The hostname is supposed to be empty since there is no hostname component to that URL. I agree the output of the location object itself is a little confusing–it confuses me too–though it’s not obvious what is the correct way to format a generic JavaScript object.
Towards the larger confusion, of being able to alert() JavaScript objects directly from the browser, but not in Python–this was due to the fact that alert() and other string-based operations in JavaScript implicitly called an object’s toString() method to make the conversion. I’ve just added code to make the Python str() method do the same thing, so in future releases, you will indeed be able to simply print base.appRunner.dom.location and see the expected results.