Hi everyone. I’m trying to access the name attribute of a window but I’m unsure of the correct syntax in this case due to the wrapped object. I’m doing this in a script executed by a frame script.
To clarify I’m trying to override window properties from a frame script. I have successfully modified the navigator and screen properties of a window but I also need to modify the name and inner/outer width/height properties of the window itself using frame scripts .
The only way I could get the screen and navigator interfaces to work was using window.wrappedJSObject but now I need to attributes of the window object directly.
Has anyone got any ideas of how I could modify those properties inside a frame script ?
window.name = “whatever” worked inside a frame script if anyone else is wondering. I still need to figure out how to modify the size attributes of the window but I will deal with that in a new issue.
Aw man no one came to help you out. It’s nice to see you made progress.
Tapping into the scope with wrappedJSObject will do the trick. I prefer not to do that though. I set up a messaging comm layer, and postMessage to the window, which returns to me the value.
Hi noitidart. It’s not exactly the standard use case so I did not imagine that too many people would have tried something similar. Using your approach can you modify the window size properties such as innerheight, outerwidth and so on ?
I send a message to the contentWindow, the message is a method name i defined in the contentWindow scope. So the message i send from the framscript triggers this function, which can do anything it wants as its in the same scope.