Monday, November 12, 2012

Windows 8 JavaScript Access Denied Runtime Error

An exception "0x80070005 - JavaScript runtime error: Access is denied." is thrown from Windows.UI.Popups.MessageDialog.showAsync() method. It turns out that another layer of the app has already shown a MessageDialog. Windows 8 can not support multiple dialogs at one time. It simple throws this "Access is denied" error. A workaround is to chain the dialogs in sequence:

messageDialog1.showAsync().then(function () { messageDialog2.showAsync()...});