Enable alert(), confirm() and prompt() in sidebar and webapp

890 views
Skip to first unread message

Darren D'Mello

unread,
Aug 2, 2021, 10:41:29 AM8/2/21
to Google Apps Script Community
Recently chrome has disabled prompts and alerts, does anyone has workaround for webapps and apps script sidebars?



Alan Wells

unread,
Aug 2, 2021, 10:46:35 AM8/2/21
to Google Apps Script Community
You can make your own modal dialogs.
See:

Darren D'Mello

unread,
Aug 2, 2021, 11:25:26 AM8/2/21
to google-apps-sc...@googlegroups.com
I agree with Alan. Thanks. Could anyone help me with a prompt to be displayed using a modal for a webapp?

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/c5226436-b918-4998-ae04-09e5e505b3f5n%40googlegroups.com.


--
Best,
Darren

Alan Wells

unread,
Aug 2, 2021, 12:01:28 PM8/2/21
to Google Apps Script Community
Because a dialog box is often needed and could be called from anywhere, you'd want to have a system that is generic.
For example, have a function name that you always use to show the dialog box.
You need a CSS file to control the styling of the modal.
You need JavaScript code to control the content and size of the dialog box.
You need a system for loading the CSS and JavaScript into your HTML before it loads.
I use scriptlets to build the HTML files before they are loaded.
I have my own dialog box system, but I don't have a tutorial or any open source repo for it.
I do use the W3 Schools CSS file, but then use my own JavaScript.
It's easier to use someone else's CSS system because everything is so interconnected, that you could spend years on developing it.
But the JavaScript is a little easier.
Do you already use jQuery or some other CSS/JS framework?

Martin Hawksey

unread,
Aug 2, 2021, 3:20:08 PM8/2/21
to Google Apps Script Community
As Alan suggests lots of frameworks out there that are easy to drop into Apps Script and the answer often depends what else you are already doing.

Personally for webapps I often turn to https://materializecss.com/ - being Material Design influenced fits in nice with existing UI used in Workspace. 



Darren D'Mello

unread,
Aug 3, 2021, 5:10:45 AM8/3/21
to google-apps-sc...@googlegroups.com
Alan and Martin Thanks for it, I am using jquery and I have no issues in adding the Material framework too
This is really really helpful.

Great Thanks!



--
Best,
Darren

Darren D'Mello

unread,
Aug 3, 2021, 6:59:11 AM8/3/21
to google-apps-sc...@googlegroups.com
I wonder now the alert and confirm and prompt work just fine from the addon sidebar. Did Google change something?
--
Best,
Darren
Reply all
Reply to author
Forward
0 new messages