The following code works in webkit: <html> <head> <script type="text/javascript"> function func(message) { return document.write(message); } </script> </head> <body> <script type="text/javascript"> window.func("message"); </script> </body> </html> So npn_invoke on the window itself should also work.