jqueryMobile dialog closes as soon as it is opened on page load in Safari only

jqueryMobile dialog closes as soon as it is opened on page load in Safari only

So my jqueryMobile dialog is closes as soon as it is opened on page load in Safari only. I have a click event attached to a link that opens it. Works just fine on all other browsers, just not Safari. Also not I have a cookie set so it only opens once. Here is a link to check it out.  jqueryMobile Dialog Issue  Any help will be greatly appreciated.

  1.  <a id='dialog' href="dialog.html" data-rel="dialog" >Dialog</a> <script> function openDialog() { setTimeout(function () { $.mobile.changePage('dialog.html'); }, 100); // delay above zero } $(function() { if ($.cookie('dialog_shown') == null) { $.cookie('dialog_shown', 'yes', { expires: 7, path: '/' }); openDialog(); } });