-
I'm new to rhino, we have the logic to use window.location object, but have no idea how the value can be injected during the execution |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Assuming you know that window.location is a (clientside) browser thing, whereas Rhino is a serverside JavaScript that doesn't know anything about browser-specific APIs: if you're embedding rhino, you can expose custom host objects, so you can inject an object with a location property under the 'window' name. See our documentation on embedding for more details |
Beta Was this translation helpful? Give feedback.
-
@orzyoung maybe it is worth to have a look at HtmlUnit (https://github.com/HtmlUnit/htmlunit) that implements a whole browser including javascript support based on (a slightly modified and enhanced) Rhino. |
Beta Was this translation helpful? Give feedback.
Assuming you know that window.location is a (clientside) browser thing, whereas Rhino is a serverside JavaScript that doesn't know anything about browser-specific APIs: if you're embedding rhino, you can expose custom host objects, so you can inject an object with a location property under the 'window' name. See our documentation on embedding for more details