w3tweaks
  • Effects
    • Scroll Effects
    • Text Effects
    • Shadow
  • Essentials
    • Arrows
    • Buttons
    • Background Patterns
    • Border Examples
    • Cards
    • Color Palettes
    • Dividers
    • Link styles
    • Loaders
    • Modal Windows
    • Notifications
    • Progress bar
    • Quote styles
    • Spinner
    • Tooltips
  • Media
    • Calendars
    • Carousels
    • Clocks
    • Gallery
    • Music Players
    • Sliders
    • Slideshows
    • Tables
    • Thumbnails
  • Navigation
  • Inputs
    • Range Sliders
    • Checkboxes
    • Toggle Switches
  • Scripts
    • Angularjs
    • Backbone.js
    • bootstrap
    • jQuery
    • ReactJs
    • JavaScript
    • Syntax Highlighters
    • tryit editor
    • PHP
  • API’s
    • Facebook
    • Google
    • Indeed
    • Twitter
    • YouTube
w3tweaks
  • Effects
    • Scroll Effects
    • Text Effects
    • Shadow
  • Essentials
    • Arrows
    • Buttons
    • Background Patterns
    • Border Examples
    • Cards
    • Color Palettes
    • Dividers
    • Link styles
    • Loaders
    • Modal Windows
    • Notifications
    • Progress bar
    • Quote styles
    • Spinner
    • Tooltips
  • Media
    • Calendars
    • Carousels
    • Clocks
    • Gallery
    • Music Players
    • Sliders
    • Slideshows
    • Tables
    • Thumbnails
  • Navigation
  • Inputs
    • Range Sliders
    • Checkboxes
    • Toggle Switches
  • Scripts
    • Angularjs
    • Backbone.js
    • bootstrap
    • jQuery
    • ReactJs
    • JavaScript
    • Syntax Highlighters
    • tryit editor
    • PHP
  • API’s
    • Facebook
    • Google
    • Indeed
    • Twitter
    • YouTube
w3tweaks
Home Script JavaScript
Navigator.sendBeacon() is great method in JavaScript

Navigator.sendBeacon() is great method in JavaScript

W3TWEAKS by W3TWEAKS
March 17, 2022
in JavaScript, Script
0

The navigator.sendBeacon() method lets you send small bits of data to a web server asynchronously and handle the response. This is a great feature for mobile web developers because it allows you to handle push notifications without blocking your app’s main thread. The sendBeacon() method can send a maximum of 1024 bytes of data, and the data is sent in the HTTP POST request body.

A blog post that talks about the usefulness of the Navigator.sendBeacon() method in JavaScript. Find the example code snippet.

You might also like

Screen Coordinates to SVG Coordinates

Best Ultimate Guide About Screen Coordinates to SVG Coordinates

March 29, 2022
3.3k
JavaScript Short Circuiting

JavaScript Short Circuiting: What It Is and How To Use It

September 24, 2021
3.3k

Navigator.sendBeacon()

document.addEventListener('visibilitychange', function logData() {
	if (document.visibilityState === 'hidden') {
		navigator.sendBeacon('/log', analyticsData);
	}
});

For more detail about Navigator.sendBeacon() please visit this website link

Tags: Javascript
Previous Post

42 Cool CSS Avatars For Better UI

Next Post

24 Best Free CSS Responsive Infographics

W3TWEAKS

W3TWEAKS

Since I've had a strong background in front-end development, I took the initiative to start my own website (w3tweaks.com) to share my knowledge with the world.

Related Stories

Screen Coordinates to SVG Coordinates

Best Ultimate Guide About Screen Coordinates to SVG Coordinates

by W3TWEAKS
March 29, 2022
0
3.3k

Let's take a look at how we can convert screen coordinates to SVG coordinates. The concept is similar to CSS,...

JavaScript Short Circuiting

JavaScript Short Circuiting: What It Is and How To Use It

by W3TWEAKS
September 24, 2021
0
3.3k

JavaScript Short circuiting is the process where the JavaScript interpreter automatically stops the execution of an expression, evaluation, or subexpression...

Extract phone numbers from string

Learn how to extract phone numbers from string in JavaScript

by W3TWEAKS
September 13, 2021
0
3.4k

Extracting phone numbers from strings is one way to clean up data that you might have collected. This tutorial will...

PHP Login system

13 Best PHP Login system

by W3TWEAKS
January 14, 2021
0
3.3k

Find the collection of Hand-Picked free PHP Login system. Scripts all developed using PHP, MySql (Database), HTML, and CSS. Below...

Next Post
CSS Responsive infographics

24 Best Free CSS Responsive Infographics

We bring you the best frontend collections that will fix perfect for news, magazine, personal blog, etc. Check our landing page for details.

  • Effects
    • Scroll Effects
    • Text Effects
    • Shadow
  • Essentials
    • Arrows
    • Buttons
    • Background Patterns
    • Border Examples
    • Cards
    • Color Palettes
    • Dividers
    • Link styles
    • Loaders
    • Modal Windows
    • Notifications
    • Progress bar
    • Quote styles
    • Spinner
    • Tooltips
  • Media
    • Calendars
    • Carousels
    • Clocks
    • Gallery
    • Music Players
    • Sliders
    • Slideshows
    • Tables
    • Thumbnails
  • Navigation
  • Inputs
    • Range Sliders
    • Checkboxes
    • Toggle Switches
  • Scripts
    • Angularjs
    • Backbone.js
    • bootstrap
    • jQuery
    • ReactJs
    • JavaScript
    • Syntax Highlighters
    • tryit editor
    • PHP
  • API’s
    • Facebook
    • Google
    • Indeed
    • Twitter
    • YouTube

Welcome Back!

Sign In with Google
Sign In with Linked In
OR

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In