HtmlPage.Window.CreateInstance and [ScriptObject_TypeDoesNotExist]

When you use HtmlPage.Window.CreateInstance to invoke a JavaScript function and the function fails you get an ArgumentException with description [ScriptObject_TypeDoesNotExist] or Type ‘…’ does not exist. Parameter name: typeName.

Unfortunately this is the same error you get when the JavaScript function cannot be found in the current scope, e.g. when the page is not yet fully loaded or the function lives in another iframe or containing page.

I would suggest using HtmlPage.Window.Invoke instead as this will not give a misleading error, though still not very specific.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s