I'm getting the error Function window.alert is not supported
The 3rd party library I'm using ("DataTables") uses the "alert" API.
Is there a way, other than manually modifying the Javascript in "DataTables", to replace the calls to "alert"
It would be nice if I could have the calls to "alert" be routed to app.showNotification() (this call is provided in App.js; a file that is normally found in the Office Add-in examples found on GitHub)
Overwrite window.alert with a function that will pass on the arguments to app.showNotification()
//if Office supports arrow functions
window.alert = message=>app.showNotification("Title",message);
//otherwise use a normal function expression
window.alert = function(message){
app.showNotification("Title",message)
};
Should probably do this in the Office.initialize handler so that it happens as soon as possible:
Office.initialize = function(){
window.alert = function(message){
app.showNotification("Title For the Notification",message)
};
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With