Function window.alert is not supported












0















  • Project: Office Add-In

  • Office-UI-Fabric-JS: 1.5.0

  • Fabric Core: 5.0.1


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)










share|improve this question






















  • Really hard to understand your question without seeing code.
    – bart
    Nov 21 at 0:38










  • You should be able to overwrite / set window.alert to a custom function that then calls showNotification, eg window.alert = function(){ app.showNotification() } More than likely would probably need to do this as soon as possible like in Office.initialize
    – Patrick Evans
    Nov 21 at 0:41












  • @PatrickEvans: Worked immediately. THANK YOU! I was able to display my tables. One last question. How do I pass along the text message that was in the alert to the showNotification function? showNotification does accept parameters.
    – ezG
    Nov 21 at 1:01










  • Just define the function argument and pass it to showNotification, see the answer i posted to see an example
    – Patrick Evans
    Nov 21 at 1:11


















0















  • Project: Office Add-In

  • Office-UI-Fabric-JS: 1.5.0

  • Fabric Core: 5.0.1


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)










share|improve this question






















  • Really hard to understand your question without seeing code.
    – bart
    Nov 21 at 0:38










  • You should be able to overwrite / set window.alert to a custom function that then calls showNotification, eg window.alert = function(){ app.showNotification() } More than likely would probably need to do this as soon as possible like in Office.initialize
    – Patrick Evans
    Nov 21 at 0:41












  • @PatrickEvans: Worked immediately. THANK YOU! I was able to display my tables. One last question. How do I pass along the text message that was in the alert to the showNotification function? showNotification does accept parameters.
    – ezG
    Nov 21 at 1:01










  • Just define the function argument and pass it to showNotification, see the answer i posted to see an example
    – Patrick Evans
    Nov 21 at 1:11
















0












0








0








  • Project: Office Add-In

  • Office-UI-Fabric-JS: 1.5.0

  • Fabric Core: 5.0.1


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)










share|improve this question














  • Project: Office Add-In

  • Office-UI-Fabric-JS: 1.5.0

  • Fabric Core: 5.0.1


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)







javascript jquery office-addins office-ui-fabric






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 21 at 0:36









ezG

355




355












  • Really hard to understand your question without seeing code.
    – bart
    Nov 21 at 0:38










  • You should be able to overwrite / set window.alert to a custom function that then calls showNotification, eg window.alert = function(){ app.showNotification() } More than likely would probably need to do this as soon as possible like in Office.initialize
    – Patrick Evans
    Nov 21 at 0:41












  • @PatrickEvans: Worked immediately. THANK YOU! I was able to display my tables. One last question. How do I pass along the text message that was in the alert to the showNotification function? showNotification does accept parameters.
    – ezG
    Nov 21 at 1:01










  • Just define the function argument and pass it to showNotification, see the answer i posted to see an example
    – Patrick Evans
    Nov 21 at 1:11




















  • Really hard to understand your question without seeing code.
    – bart
    Nov 21 at 0:38










  • You should be able to overwrite / set window.alert to a custom function that then calls showNotification, eg window.alert = function(){ app.showNotification() } More than likely would probably need to do this as soon as possible like in Office.initialize
    – Patrick Evans
    Nov 21 at 0:41












  • @PatrickEvans: Worked immediately. THANK YOU! I was able to display my tables. One last question. How do I pass along the text message that was in the alert to the showNotification function? showNotification does accept parameters.
    – ezG
    Nov 21 at 1:01










  • Just define the function argument and pass it to showNotification, see the answer i posted to see an example
    – Patrick Evans
    Nov 21 at 1:11


















Really hard to understand your question without seeing code.
– bart
Nov 21 at 0:38




Really hard to understand your question without seeing code.
– bart
Nov 21 at 0:38












You should be able to overwrite / set window.alert to a custom function that then calls showNotification, eg window.alert = function(){ app.showNotification() } More than likely would probably need to do this as soon as possible like in Office.initialize
– Patrick Evans
Nov 21 at 0:41






You should be able to overwrite / set window.alert to a custom function that then calls showNotification, eg window.alert = function(){ app.showNotification() } More than likely would probably need to do this as soon as possible like in Office.initialize
– Patrick Evans
Nov 21 at 0:41














@PatrickEvans: Worked immediately. THANK YOU! I was able to display my tables. One last question. How do I pass along the text message that was in the alert to the showNotification function? showNotification does accept parameters.
– ezG
Nov 21 at 1:01




@PatrickEvans: Worked immediately. THANK YOU! I was able to display my tables. One last question. How do I pass along the text message that was in the alert to the showNotification function? showNotification does accept parameters.
– ezG
Nov 21 at 1:01












Just define the function argument and pass it to showNotification, see the answer i posted to see an example
– Patrick Evans
Nov 21 at 1:11






Just define the function argument and pass it to showNotification, see the answer i posted to see an example
– Patrick Evans
Nov 21 at 1:11














1 Answer
1






active

oldest

votes


















0














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)
};
};





share|improve this answer





















  • That worked perfectly. Thank you Patrick.
    – ezG
    Nov 21 at 13:11










  • @ezG If you satisfied with the answer consider to accept it. Accepting Answers: How does it work?
    – Slava Ivanov
    Nov 22 at 14:34











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53403698%2ffunction-window-alert-is-not-supported%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














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)
};
};





share|improve this answer





















  • That worked perfectly. Thank you Patrick.
    – ezG
    Nov 21 at 13:11










  • @ezG If you satisfied with the answer consider to accept it. Accepting Answers: How does it work?
    – Slava Ivanov
    Nov 22 at 14:34
















0














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)
};
};





share|improve this answer





















  • That worked perfectly. Thank you Patrick.
    – ezG
    Nov 21 at 13:11










  • @ezG If you satisfied with the answer consider to accept it. Accepting Answers: How does it work?
    – Slava Ivanov
    Nov 22 at 14:34














0












0








0






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)
};
};





share|improve this answer












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)
};
};






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 21 at 1:10









Patrick Evans

31.8k54470




31.8k54470












  • That worked perfectly. Thank you Patrick.
    – ezG
    Nov 21 at 13:11










  • @ezG If you satisfied with the answer consider to accept it. Accepting Answers: How does it work?
    – Slava Ivanov
    Nov 22 at 14:34


















  • That worked perfectly. Thank you Patrick.
    – ezG
    Nov 21 at 13:11










  • @ezG If you satisfied with the answer consider to accept it. Accepting Answers: How does it work?
    – Slava Ivanov
    Nov 22 at 14:34
















That worked perfectly. Thank you Patrick.
– ezG
Nov 21 at 13:11




That worked perfectly. Thank you Patrick.
– ezG
Nov 21 at 13:11












@ezG If you satisfied with the answer consider to accept it. Accepting Answers: How does it work?
– Slava Ivanov
Nov 22 at 14:34




@ezG If you satisfied with the answer consider to accept it. Accepting Answers: How does it work?
– Slava Ivanov
Nov 22 at 14:34


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53403698%2ffunction-window-alert-is-not-supported%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

TypeError: fit_transform() missing 1 required positional argument: 'X'