Sistema Fenix Posted October 19, 2016 Share Posted October 19, 2016 Hi Follows a tip for using the notification by the browser. Add push_notification.js in folder files Add in the uniServerModule->CustomFiles To dispare notification: procedure FenixNotification(pTitle, pMessage:String); var vJS: String; begin vjs := format('jQuery(document).ready(function($){$.notify("%s",{title: "%s", icon: "http:\\dominio.com\yourimage.png"});});',[pMessage,pTitle]); UniSession.AddJS(vjs); end; procedure TFMenu.ButtonNotrClick(Sender: TObject); begin FenixNotification('Fenix','Your session is expiring.'; end; Best regards push_notification.zip 3 Quote Link to comment Share on other sites More sharing options...
Harry Rogers Posted October 19, 2016 Share Posted October 19, 2016 Thanks for that Fenix - it works a treat. Quote Link to comment Share on other sites More sharing options...
mehmet07 Posted October 19, 2016 Share Posted October 19, 2016 thanks Fenix Quote Link to comment Share on other sites More sharing options...
Harry Rogers Posted October 20, 2016 Share Posted October 20, 2016 How would you go about adding an audio notification to this? Cheers Quote Link to comment Share on other sites More sharing options...
Sistema Fenix Posted October 20, 2016 Author Share Posted October 20, 2016 Hi HarryG, I found nothing about audio. You can use another command before calling the notification. Look at this example: https://github.com/admsev/jquery-play-sound https://jsfiddle.net/admsev/xscxya0g/ Quote Link to comment Share on other sites More sharing options...
Harry Rogers Posted October 21, 2016 Share Posted October 21, 2016 Ok many thanks Fenix Quote Link to comment Share on other sites More sharing options...
roneydourados Posted June 28, 2017 Share Posted June 28, 2017 Thanks Fenix!!!!!!! Quote Link to comment Share on other sites More sharing options...
sparkz Posted September 8, 2017 Share Posted September 8, 2017 Fenix, this looks like a really useful bit of code. I'm new to the java side and am struggling to get this to work - I get "$.notify is not a function" errors. I suspect because I haven't setup things correctly. Have you got a sample project with this or some other bit of JS so I can learn from it. Thanks Quote Link to comment Share on other sites More sharing options...
sparkz Posted September 9, 2017 Share Posted September 9, 2017 The .js file is included in the server CustomFiles: files/push_notification.js I'm calling the following on a button click in the client main form: procedure PushNotification(sTitle, sMessage: String); var sJS: String; begin sJS := Format('jQuery(document).ready(function($){$.notify("%s",{title: "%s", icon: ""});});', [sMessage, sTitle]); UniSession.AddJS(sJS); end; But I get the following error: I can put the JS code into the script directly and it works fine but I can't get the interaction between calling the "notify" function and the library .js file to work. I assume it's not finding the library? It seems to be one of those aspects not well documented, I'd really appreciate if someone could tell me what I may be missing... JSTest.zip Quote Link to comment Share on other sites More sharing options...
acms Posted December 14, 2017 Share Posted December 14, 2017 Same problem to me : "$.notify is not a function" Fenix, this looks like a really useful bit of code. I'm new to the java side and am struggling to get this to work - I get "$.notify is not a function" errors. I suspect because I haven't setup things correctly. Have you got a sample project with this or some other bit of JS so I can learn from it. Thanks Quote Link to comment Share on other sites More sharing options...
leons Posted December 14, 2017 Share Posted December 14, 2017 Hi Fenix, Works on my local machine for Chrome, IE and Edge with the program as stand-alone server. On IIS/ISAPI on the server as dll, only Edge is working. Any idea? Leon Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.