c# - browser notification only once for all opened tabs per site -


i have news site powered c# asp.net mvc 5.0 , want push notification clients browser when admin add/edit or delete news.
added signalr script template used in pages.

_layout.cshtml

var notificationshub = $.connection.notificationhub; $.connection.hub.start(); jquery(function($) {     notificationshub.client.toast = function (title, body) {         var options = {             body: body,         };         var notification = new notification(title, options);     }; }); 

and added code page redirects after news add/edit/delete done

<script>     $.connection.hub.start().done(function() {         notificationshub.server.toast('@notificationhub.type.tostring()', '@html.raw(notificationhub.title)', '@html.raw(notificationhub.body)');     }); </script> 

when add/edit/delete news works fine problem pushes notification opened tabs in site. there trick avoid happening , show only one browser notification per site?

then have know number of open tabs , url used. see "how number of tabs opened of web in browser using jquery?" question discussion not desired privacy reasons.


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -