Javascript - Show message when "No connectivity detected” - javascript

Please note that this question is in consequence of another question: "Codename One - ToastBar when “No connectivity detected"
What is a correct approach (in Javascript or JQuery) to deal with Internet connection unavailability (that is common on mobile devices)?
Every time that there is a networking error, I would like to show a message to the user (like this one: https://i.stack.imgur.com/Ll6jD.png) and pause the Internet activity of the web page, in a way that no errors are generated (and the messages written by the user, for example in an html form, are not lost). The Internet activity should be (automatically) restored when the connection will be available again.
This should be a convenient way to allow people to interact with a web site (from mobile devices) without the risk of losing their posts or comments and without receive errors when they click a link.
This functionality should be as much as possible independent from the specific web site. What is a correct way to implement it?

use jquery plugin like this :
Offline.js

Related

How to find whether the user is watching our website or not(it should work when switching applications also)?

I am creating a chat application, where I need to send notifications when the user is not watching my website or working in another application.
Now, most of the use cases can be handled using the page visibility API. But there is a particular use case when the user is switching the application from browser to any other application(ex: Outlook), I want to send a notification at that time.
But the issue here is page visibility API does not provide anything on switching applications. That is if the browser active tab has my website and the user switches the application from browser to any other application, it still thinks the user is looking at my website which is wrong because the user is in anther application right now.
I have done R&D on this and I see it is impossible because browsers can't detect these kinds of changes due to security reasons.
But when I checked with Whatsapp web there, javascript is able to find weather user opened the current application or not and based on that they are sending notifications.
So, How can I implement same feature that Whatsapp guys implemented? Is there any web API I am missing here. Are any hacks available to implement this kind feature?
Thanks in advance.

How to detect web page crash (not browser crash) using PHP?

How can we detect through PHP or maybe in node.js or other languages if a web page crashed (without the browser EXITing) so that when a user press the "reload" button on the "Aw Snap" page in chrome certain specific content inside the page can be shown in this particular case (crash case).
In a crash without EXIT, a browser shows per example in Google Chrome the famous "Aw, Snap!" page.
I don't want to know how to capture if the user refreshed the page or the page reloaded which can be known quite easily with different methods [one example see this PHP this code which can detect if users refreshed the page on major desktop/mobile browsers except IE unfortunately this code does not capture a crash event and the fact that user might request again the same page after a crash.
I tried using "register_shutdown_function", and some other maneuvers using connection PHP functions like "connection_aborted" etc... but with no success. I figure out a sloppy way through the use of session variables but probably there are better clever manoeuvres.
Any help or suggestion would be greatly appreciated. Any solution in nodejs will be also welcomed.
web brower crash because too many process from your browser to PC of Client.
this crash can't detected by php because PHP server scripting. and you have question.., why not use JS for detect crash of browser?, because JS created just for controller website,. if you force to checked that use ajax, node, etc you can't do that, why? because the problem comes suddenly
and detected crash browser from php is impossible.

How should I create "screen sharing" with SignalR

I know this is not a specific question, but I just want to get design ideas about a screen sharing web site with SignalR.
We want to add a link on our website which is called "Share My Screen" and then our support team be able to see the content of the browser (not whole desktop) and even they be able to click or type on customer browser.
I was thinking to do it as
Taking screen shot from browser by js (by http://html2canvas.hertzen.com for example)
send taken screen shot to server constantly (I don't know how yet)
Server sends the received screen shot to our support team browser
Capturing mouse move and key press on support team browser
Sending this captured data to customer browser
Since each part of this needs a lot of work I just want to gather all possible ideas to find a tested solution
First of all, I do not think your idea of capturing screen is really doable with javascript technology. Security would be a huge issue, you would need to process a high amount of data, and syncing events would be a nightmare no matter how you approach it. Capturing and sharing tab content and events is a much more manageable goal.
If you are aiming to use this for people who can not manage to install a remote control app, then we can count newer technologies such as WebRTC out due to browser compatibility issues.
There is a good blog post discussing this issue here - (Screensharing a browser tab in HTML5?).
I especially like the first method, using Mutation Observer (browser support) and Web Sockets (browser support). It basically syncs two html documents through the use of mutation observer and uses web sockets for communication. You could use SignalR instead of standard web socket API for communication if you prefer.

IE9 Javascript injection issue

I am facing some issue with Javascript injection on IE9 (>Medium-high security). In my application when user wants to add any web page to their bookmarks, they click a link, and it injects a Javascript into that page, this injected javascript grabs all details about page and redirect users to my site.
On IE9, it does not seems to be working with Medium-high security. I suspect this has to do something how IE9 handles cross-site javascript injection. But, was not able to find any relevant information.
Can someone please help or guide me to some related information.
Thanks
You may find this TechNet post useful, especially the row "Allow scripting of Internet Explorer Web browser control".
Apparently Internet Explorer doesn't allow scripts to control the web browser except on Medium-Low and Low security levels. Because of this, you won't be able to redirect the browser unless it's set to one of those two levels.
Perhaps instead of redirecting them you could add some kind of notification to the DOM and give them a link to your website?

Constant Client Disconnects in Classic ASP Web Application

I'm working with a Classic ASP web app that typically runs well considering the old technology. It is an online support chat application that basically refreshes the client side Live Monitor page every 10 seconds to see if there are any pending chat requests. The past few days, a lot of our users are having a problem where this page either just ends up refreshing and going blank white (with no html in view source), or it goes to a generic IE error page "This program cannot display the webpage" - the same error you see when you are offline. I was able to recreate the issue after hours when I was the only user in the chat system, so it's not a matter of an overloaded server I don't think.
I've tried the following to no avail:
Recycle Application Pool
Reboot IIS Server
Change refresh from javascript to meta tag
Check IIS Error logs (nothing)
Check IIS event logs (nothing)
One thing that seemed to work for me, but didn't work for everyone else, was to disable our network Proxy server settings in the browser. Once I disable this, I can't get it to error out anymore... however, other users aren't quite so lucky.
Any thoughts on where to go with this? I'm at a bit of a loss here...
Thanks,
Shawn
We are finding the same problems in a .Net solution. It looks as if the issues are related to SQL Locking so we're working on those as we find them.

Categories

Resources