This is the Code I use to create my cookie
document.cookie = (firebase.auth().currentUser.phoneNumber);
handleSignedInUser(user);
This is the code I use to read the value of my cookie and assign its value to a google map marker label
var markerLabel = document.cookie;
var marker = new google.maps.Marker({
position: {
lat: data.User.l[0],
lng: data.User.l[1]
},
map: map,
label: markerLabel
});
Picture of Homepage Instead of only displaying the phone number it also says phone number undefined. Another stack overflow user mentioned that Im not returning the value of the cookie correctly. I found this function for returning the value of a cookie on https://www.w3schools.com/js/js_cookies.asp
function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}