[ad_1]
Safari iOS is treating my script otherwise than Chrome cellular by not executing the final step and POSTing the info.
The way in which it ought to work (and the way in which it really works w/ Chrome cellular) is:
- the person hits the route
/occasions/${eventID}/immediate, - the immediate web page runs the guestValisate.js script
- the guestValidate.js script runs a geolocation validation
- which POSTs information to the
/occasions/${eventID}/immediateroute
Geolocation works on each cellular browsers and Safari iOS requires a safe connection (https) whereas Chrome doesn’t. I deployed on Heroku and my connection is safe.
immediate.ejs
<% structure('layouts/boilerplate') %>
<div class="card mb-3 bg-light">
<div class="row">
<div class="col-md-8">
<div class="card-body">
<h5 class="card-title">Thanks!</h5>
<h6 class="card-subtitle mt-4 mb-4 text-muted">Would you wish to throw some cash of their digital tip jar?</h6>
<a href="https://venmo.com/<%=occasion.artist.venmo%>" class="card-link" goal="_blank">venmo hyperlink</a>
</div>
</div>
</div>
</div>
<script src="/javascripts/guestValidate.js"></script>
guestValidate.js
const date = Date().toString();
const currentDateParse = Date.parse(date);
const cookies = doc.cookie //https://www.youtube.com/watch?v=8tL5P-RtAH0
.break up(';')
.map(cookie => cookie.break up('='))
.cut back((accumulator, [key, value]) =>
({ ...accumulator, [key.trim()]: decodeURIComponent(worth) }),
{});
const splitCoords = eventCoords.break up(',');
if (cookies.event_id == eventID)
{
if(affirm('Do you approve sharing your present location?')) {
navigator.geolocation.getCurrentPosition(({ coords }) => {
if (
splitCoords[1] - coords.latitude >= -0.009 &&
splitCoords[1] - coords.latitude <= 0.009 &&
splitCoords[0] - coords.longitude >= -0.009 &&
splitCoords[0] - coords.longitude <= 0.009
) {
const standing = "Y";
const visitor = cookies.guest_id;
const information = { standing, visitor };
const choices = {
technique: 'POST',
headers: {
'Content material-type': 'utility/json'
},
physique: JSON.stringify(information)
};
fetch(`/occasions/${eventID}/immediate`, choices)
} else {
console.log("Visitor shouldn't be on the occasion.")
}
})} else {
console.log("The check-in locator was denied.")
}}
else
{
console.log("Visitor didn't test in for this occasion.")
}
router
router.route('/:id/immediate')
.get( isLoggedInAndAlreadyStarted, catchAsync(occasions.showPrompt))
.publish(catchAsync(occasions.checkIn)) // <- that is for when the immediate web page is operating
Each browsers ask the person in the event that they “approve sharing location” so the geolocate function is operating on each however why is Safari iOS stopping in need of POSTing the info?
[ad_2]
