How can i store count while open the mail
You're asking how to store a count while the email is open. Here are a few possible solutions:
Method 1: Using a local storage
You can use the localStorage
API to store the count while the email is open. Here's an example:
// Set the count
localStorage.setItem('emailCount', 1);
// Later, when you want to retrieve the count
var count = parseInt(localStorage.getItem('emailCount'));
Method 2: Using a cookie
You can use the document.cookie
property to store the count as a cookie. Here's an example:
// Set the count
document.cookie = 'emailCount=1; expires=Fri, 31 Dec 9999 23:59:59 GMT';
// Later, when you want to retrieve the count
var count = parseInt(document.cookie.match(/emailCount=([0-9]+)/)[1]);
Method 3: Using a JavaScript variable
You can store the count in a JavaScript variable that persists across page reloads using the sessionStorage
API. Here's an example:
// Set the count
sessionStorage.setItem('emailCount', 1);
// Later, when you want to retrieve the count
var count = parseInt(sessionStorage.getItem('emailCount'));
Method 4: Using a server-side solution
If you're using a server-side language like PHP, you can store the count in a server-side variable and retrieve it when the email is opened. For example:
<?php
session_start();
$count = 1;
$_SESSION['emailCount'] = $count;
// Later, when you want to retrieve the count
echo $_SESSION['emailCount'];
?>
Remember to adjust the storage method according to your specific use case and requirements.