Apple refused to develop 16 WebAPIs for Safari and conspiracy theories

Tram Ho

Preface

Just last week, the developer community around the world was “stirring up” when Apple announced it would NOT support 16 Web APIs for its Safari browser. If you try to search google, the keyword “Apple declined to implement 16 Web APIs” will show that the pages are large and small. So what are these 16 Web APIs specifically? Does Apple reject them have any effect on our programmer’s shirt? Take a look together and you will have the answer for yourself.

In this article, I will try to explain more clearly about the market context, then I will help you understand (the basics) of each API and its application. Of course, my explanations come from personal self-study, so if there are any mistakes, please comment in the Comments section.

The technological gap between App and Web

The fight silently keeps the Web (app) and Mobile app

Ask yourself why do we download an app from the Appstore instead of using web pages with similar functionality? There are many reasons that can not be mentioned, I would like to list a few random reasons according to my memory (I default you to understand that the native app, not webapp):

  • App runs much faster than the web?
  • App can run offline, web can’t?
  • App has features like Geolocation, Bluetooth, Push notification, Device Motion, Sensors … web?

DRILL, it seems something is NOT right! If you feel like that, then it proves that you are also very up to date with technology news. Yes, the web has these features, and much more.

Web is evolving day by day, series of APIs are developed in a race against the app. What app can do, the web is gradually shortening the distance with the app. And in the not too distant future, will the web replace apps? Do you believe that?

You can refer to the website What web can do today.

“Conspiracy Theory” about Apple

What do you think if indeed the web will replace apps, and users will no longer download apps from the Appstore? What will Apple do if the app has no more land to use martial arts? How will native app developers change to adapt?

And so, there are rumors that Apple is trying to slow down the development of the web to limit the threat to its empire. And that rumor is even more believed when Apple has just refused to support 16 Web APIs that increase the power of the web and shorten the gap with the app.

What is the reason Apple gave?

User Fingerprinting

The rumors above are still just rumors. The reason Apple has come up with is to avoid “user fingerprinting”. Simply put, Apple does not want to increase the likelihood of users being stolen information about web usage (by online advertising companies or companies that collect and analyze user information) to serve many items. Different destinations like online advertising …

Of course, the reason Apple gives is very reasonable with its long-standing product development philosophy. So the above rumor is that I added it for readers to play to know.

16 Web API was denied support by Apple

I would like to extend one more sentence. Although Apple refused to support (for Safari), but most of them are supported by Chrome and Firefox, so we can still be optimistic about the development of the web in the future.

1. Web bluetooth

This API allows website to connect to nearby devices via bluetooth. With just this API, its application is immense. Imagine your house using a light bulb that is turned on and off via bluetooth. Normally, you will have to download the app to open and switch control, but now the web can do it.

Application : https://googlechrome.github.io/samples/web-bluetooth
Can I Use : https://caniuse.com/#feat=web-bluetooth
Demo: try to turn on bluetooth on your device and run this simple code with Chrome:

Bluetooth availability

2. Web MIDI API

MIDI stands for Musical Instrument Digital Interface. It is an API for connecting and manipulating electronic music devices.

https://unsplash.com/photos/sWbGwr1fOUk

I belong to the group of music blind, so I am not interested in this Web API. If you are interested, you can learn more.

Reference: https://www.smashingmagazine.com/2018/03/web-midi-api/
Can I Use : https://caniuse.com/#feat=midi

3. Magnetometer API

This API allows the site to connect to surrounding magnetic field (magnetometer) sensors. This is a lesser known type of sensor that makes it possible for the site to read the strength of the magnetic field using the device’s sensors. Its application is usually intended for peripheral devices like a gamepad (which controls a player’s actions), or it can also turn your website into a compass. You can refer to the WebVR (Web Virtual Reality) application demo at the link below. I am not really good at this field, if you want to learn more about it, you can google more.

Demo: https://intel.github.io/generic-sensor-demos/
Can I Use : https://caniuse.com/#feat=mdn-api_magnetometer

4. Web NFC API

This API allows websites to interact with NFC smart tags (called Tags) through an NFC reader. According to the mobile world , NFC (Near-Field Communications) is a short-range wireless connection technology within a distance of 4 cm. This technology uses magnetic induction to make connections between devices (smartphone, tablet, speaker, headset, …) when there is direct contact (touch).

An example of an NFC reader

The API is still under development and is not available in current browsers. However, you can experiment with Chrome when enable-experimental-web-platform-features .

Can I Use : https://caniuse.com/#feat=webnfc

5. Device Memory API

Allows the site to get information about the device’s memory (RAM) (in gigabytes). This API is quite simple, try running this script with Chrome:

Device memory API

Can I Use : https://caniuse.com/#feat=mdn-api_navigator_devicememory

6. Network Information API

This API provides information about the device’s network connection, and lets websites know when the connection type has changed. Try running this script with Chrome:

Network information API

Reference: https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation
Can I Use : https://caniuse.com/#feat=mdn-api_networkinformation

7. Battery Status API

This API provides information about the battery of the device, for example how much battery is remaining, is it plugged in or not … Please try this script with Chrome test:

Battery status API

Reference: https://developer.mozilla.org/en-US/docs/Web/API/Battery_Status_API
Can I Use : https://caniuse.com/#feat=battery-status

8. Web Bluetooth Scanning

Allows the site to scan for Bluetooth connected devices within range. This functionality is still in development, if you want to experiment, you can enable the enable-experimental-web-platform-features flags.

Demo: https://googlechrome.github.io/samples/web-bluetooth/scan.html
Reference: https://www.chromestatus.com/feature/5346724402954240

9. Ambient Light Sensor

Google translate: “Allows the website to know the current light level or the illuminance of the ambient light through the device’s sensors. Imagine yourself surfing the web, the level of light. If the room drops naturally (someone pulls the curtain, for example), the site will automatically switch to color modes that match the current brightness level.

Demo (Ambient Map demo): https://intel.github.io/generic-sensor-demos
Can I Use : https://caniuse.com/#feat=mdn-api_ambientlightsensor

10. HDCP Policy Check extension for EME

HDCP stands for High-bandwidth Digital Content Protection. This API allows the website to check if the device has “HDCP policies”, which are commonly used in streaming video. HDCP is not in my knowledge, so I am briefed on translating some information from online sources.

HDCP’s purpose is to protect copyright of digital content when it is transmitted to your TV, usually through an HDMI or DVI connection. Netflix requires HDCP when streaming content from the device connected to your TV.

Today, HDCP is a mandatory policy to stream high quality content. In the old days, web developers who wanted to get HDCP rights would have to wait for a license or be forced to stream at low quality. HDCP Policy Check API was born to solve that problem.

Reference: https://developers.google.com/web/updates/2018/08/chrome-69-media-updates#hdcp
Demo: https://googlechrome.github.io/samples/hdcp-detection/

11. Proximity Sensor

Lets the site know the distance (and other information) between your device and a distant object, via your “proximity sensor” sensor. An example to imagine its application to the app. Did you notice when you make a call (smartphone), you place the phone near your ear to listen, and wow (just the sensor fires an event), the phone turns off the screen to save battery power (and reduce hot device). Its applications are countless, just you can think of it.

Proximity events API

Reference: https://developer.mozilla.org/en-US/docs/Web/API/Proximity_Events
Can I Use : https://caniuse.com/#feat=proximity

12. WebHID

Allows the site to know information about the connected HID (Human Interface Device) devices. These devices are for example: computer mouse, keyboard, gamepad, touchscreen …

Reference: https://blog.scottlogic.com/2019/04/03/upcoming-webhid-api.html

13. Serial API

Allow the website to read and write data from devices such as microcontroller, 3D printer … I don’t care about hardware, but if you love hardware, then you will understand its application much. Come on.

Reference 1: https://github.com/svendahlstrand/web-serial-api
Reference 2: https://dev.to/unjavascripter/the-amazing-powers-of-the-web-web-serial-api-3ilc
Demo: https://codelabs.developers.google.com/codelabs/web-serial/#0

14. Web USB

Allows site to communicate with devices via USB (Universal Serial Bus) port. Of course when it comes to USB, we are not only talking about the storage devices we call USB, but also other devices like mice, keyboards and many other devices. And with those “non-standardized” USB devices, usually we will have to install the driver to be able to use it. That’s one of the problems that the WebUSB API solves.

Try running this script with Chrome:

WebUSB API

Reference: https://developers.google.com/web/updates/2016/03/access-usb-devices-on-the-web Can I Use : https://caniuse.com/#feat=webusb

15. Geolocation Sensor

Before that we have Geolocation API, and this is the “better” extension. It is introduced as being consistent with other APIs in the Sensor APIs “family” ( https://www.w3.org/das/roadmap ), increasing security, privacy, and ease of opening. wide.

Reference: https://www.w3.org/TR/geolocation-sensor/

16. Idle Detection

Allows us to know when the user is in the “idle” state, or can just be said, not interacting with the device. User idle states such as: the user does not interact with the mouse, keyboard, or monitor, turns on screensaver mode, locks the screen, or acts on another screen. We can set a time period to fire this event.

Reference: https://web.dev/idle-detection/

Conclude

As you can see, the above APIs are mostly developed so that the Web can interact with hardware and users better (it’s simple with mobile apps, windows apps or macos apps). However, it’s too convenient to be used by bad guys, and that is also the reason Apple refuses to develop the above APIs, even Chrome and Firefox have to consider some APIs for the same reason.

What is your opinion, please leave a comment below.

Share the news now

Source : Viblo