Alternative to Chrome's Background Fetch Api? - javascript

So I just came across Chrome's "Background Fetch API" and I'm wondering if Firefox and Safari provide a similar API.
Is there an API provided by Firefox and/or Safari that allows applications to successfully fetch large files (e.g. 100mb) - even when users navigate away from the relevant tab or window?
If not, is there a feasible way to polyfill this behaviour?

Related

How to work around lack WebRTC support in a browser?

Some browsers (mobile Mi Browser, for instance) don't support WebRTC - they have no RTCPeerConnection API. So the users of your WebRTC web app have to open it in another one.
Is there a way to make your WebRTC app work without an explicit browser-change action from the user, especially on a mobile device?
I tried to investigate the following:
Deep Link. Looks like we can't redirect the user to another browser using deep link (I haven't found Chrome deep link for mobile).
Send WebRTC sources to browser / use third-party WebRTC lib. This won't work either, you need WebRTC support in the browser source code.
WebRTC is a framework based on a set of standards. It includes not only capability to get information about user input/output devices, but also set of network protocols which based on UDP (from getting client's IP to transfer arbitrary data through data channel using SCTP protocol). So, as you already may guess, it's impossible to support in a browser which doesn't have it, this is why point (2) will not work.
In case of point (1 - Open Chrome). On iOS exists custom protocol to open URL in chrome "googlechromes://stackoverflow.com", but it's better to explicitly say user that current browser doesn't support required functionality; And provide links on list of popular browsers for download (Chrome, Firefox, etc.); And already on these websites user will be redirected to the proper store for downloading native app.

PWA push notification on IOS

I am looking for a way to send and display notifications on ios pwa apps.
I know it is not possible since the ios safari (and non of the other browsers on ios) support neither the push api nor the notification api.
I am wondering if there was a workaround to do that.
I have already taken a look at this answer, but honestly didn't understand at all.
The truth is NOT for mobile Safari, at the time I write this answer. I am doing a long research... The Apple PWA on Safari increased a lot, but is not comparable to others like Google Chrome browser. As It was said in the article:
At this point in time Apple's iPhone and iPads do not support native
push notifications. You can gracefully fallback to SMS notifications.
So, till the moment I have this resume to share:
Do Progressive Web Apps (PWA) work on iOS? YES...
Apple may wants to turn the PWA as an alternative to the Apple Store.
We still can’t open an external link in Safari
Still can’t use Push Notifications
There is a 50MB service worker cache limit
Web apps that have not been used will have their cached assets purged after 7 days
Fonts:webkit.org,developer.apple.com,brainhub.eu,love2dev.com,firt.dev
NEW:
Push API is currently in development for Safari (including iOS). It is not currently finished but should be available for testing in a Safari Technology Preview within the next few months.
OLD:
It is not possible to have Push Notifications on Safari. It's been brought up many times and has even been a topic of this years WWDC.
See the following threads:
https://developer.apple.com/forums/thread/681575
https://developer.apple.com/forums/thread/681748
If developers want push notifications in Safari we'll need to have a much louder voice. As stated in the link above, native apps got notifications in 2009, it's 2021 and Apple has not even indicated if they are willing to work on it.

Is it possible to activate the reading mode of Firefox or Chrome with Selenium Webdriver?

I am trying to automate some online media news downloads. Since not all web pages follow the DOM of their structure, I open web pages with Chrome or Firefox and take screenshots and then send them to an OCR of my own development. The problem is that it brings a lot of junk information from the advertising and the page. For this reason, I thought about making selenium open the browser's reading view and extract much cleaner information.
The readability library that Mozilla uses in Firefox is open source and available here: https://github.com/mozilla/readability
You can fetch the web contents in selenium and pass out all through this process to get the text output without needing an OCR step at all.

Chrome Tab Sync javascript API

Is there a javascript API for Chrome Tab Sync for web sites? I'm not asking about Chrome Extensions, just web sites.
For example, I'd like to store some text (a string) when you open a web site on the desktop then when you open that same page in the chrome mobile browser I'd like to display that stored text.
Is this possible? I know with Chrome Extensions there is chrome.storage, but I don't believe that is available for websites.
You should store that information:
on your server,
in the URL of the page (?mystring=...),
or on your server with a lookup key for the specific info in the URL.
Any one of these is an ordinary thing to do and will work for all browsers and all ways to get a page from one device to another, without relying on any features specific to Chrome.

Is there a way to capture images from Webcam?

Is there a way to capture images from a webcam with JavaScript?
Nope - think of the security implications!
It is possible with Flash, but the user will see a popup requesting access to their webcam.
If the webcam had a web interface, then in theory it would be possible to just slap an image tag into a page somewhere and point it directly at the cam's snapshot interface:
<img src="http://address.of.webcam.example.com/webcam/capture" />
But otherwise, no. Standard Javascript has no API for accessing a webcam. There's no
var wc = new WebCam();
img = wc.capture();
type calls you can do.
The situation has changed from when this question was originally posted. The getUserMedia API was introduced to allow things like capturing webcam images. You can find tutorials and plugins demonstrating it.
But MDN now says the Navigator.getUserMedia API is deprecated in favour of the experimental API MediaDevices.getUserMedia. The getUserMedia tutorials and plugins don't work on iOS devices - they just don't support it.
The answer at the moment seems to be that there is an HTML API for it, but browser support is patchy and the API is possibly on its way out. You can only use it in Firefox and IE Edge, and in Chrome only from an https domain.
I would like to revive this question and ask if anyone knows of any web API that will successfully capture webcam images in all major browsers and devices.

Categories