Dealing with the issue of iPhone "Bookmark to Homescreen" removing cookies and sessions, I have come up with a jQuery solution. Learn more about this problem here.
In essence, by using JavaScript to create add to homescreen kit launch links, you can avoid being redirected to Safari, which typically clears any cookie information stored.
<script>
$(function(){
$('a[href]').click(function(e){
e.preventDefault();
document.location.href = $(this).attr('href');
return false;
}) ;
});
</script>
However, as I prefer not to use jQuery on this particular site, I am seeking assistance in developing a pure JavaScript solution. This script should only need to be compatible with Safari, as we are primarily targeting that platform. Additionally, having a method to detect the Safari browser would be beneficial, since other platforms do not support the add to homescreen feature we are focusing on.