cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Community Member

Can I capture a 'Dismiss Notification' click?

Is there a hook in Canvas that will tell me if my notification from my plugin was dismissed (by clicking the small 'x')?

Tags (1)
0 Kudos
8 Replies
Highlighted
Community Advocate
Community Advocate

Hi griffindodd@gmail.com

Maybe?...

Is your plugin a true LTI, loaded in an iframe, a custom Theme or User Script, or a backend script you use to trigger something in Canvas?

Where is the notification, is it a Conversations API, Announcements, or something else?

You can use Canvas Themes and custom JavaScript to capture events in the DOM, but that won't work from within an LTI.

If you use custom JavaScript, you can capture the event, but you have no way to communicate that back. One solution would be to use Custom Data - Users API in that JavaScript, and then read it later, and delete it after reading.

Can you offer some more details?

Highlighted

Thanks for the reply.

I'm just talking strictly about the Canvas built-in in notification system and whether there is an event/hook generated when a user clicks on the dismiss 'x' button of a displayed notification. I guess inthis case it would be an announcement.

0 Kudos
Highlighted

Is the announcement on a course or global dashboard?

Do you know how to use JavaScript for watch for events on an element?

0 Kudos
Highlighted

It is on the global dashboard. We could certainly put together a script if you could point me to the details on how to watch the element

0 Kudos
Highlighted

Robert,

I don't see how what you are suggesting could work. Any Javascript inside the notification is stripped during the upload for security reasons by Canvas, so there is no way to monitor or capture any events as you suggest. Have you actually done this, or am I misunderstanding what you were suggesting?

0 Kudos
Highlighted

sdtriathlete@gmail.com 

You are misunderstanding. Robert is talking about putting something into your global custom JavaScript via the Theme Editor. It is not something that gets put into the content created through the Rich Content Editor. Things done through the global custom JavaScript live outside the restrictions of sanitizing JavaScript from content, so its use  is limited to the Canvas admins.

0 Kudos
Highlighted

Thanks James. That helped.

0 Kudos
Highlighted

Thanks Robert.

You pointed me in the right direction, although now I'm getting an error when it tries to load the custom JS - see this question if you have a moment:

https://community.canvaslms.com/thread/55697-getting-422-unprocessable-entity-error-when-loading-cus... 

I also tried loading it in Safari to see if the browser made a difference....it did not.

Andy

0 Kudos