jquery/jquery-mobile — Issue #2886: dialog close inserts an href="#", causing the address bar to appear on mobile Safari
Author: NickAger
Created: 2011-10-30 12:26:08+00:00
State: open

Any anchor which includes an href attribute causes Safari's address bar to briefly appear. It is possible to workaround this by using $.mobile.changePage on [content you control](http://forum.jquery.com/topic/stopping-the-url-bar-from-dropping-down-i-discovered-a-workaround). However the close button is automatically created by javascript within the jquery mobile library:

```javascript
_create: function() {
var self = this,
$el = this.element,
pageTheme = $el.attr( "class" ).match( /ui-body-[a-z]/ ),
headerCloseButton = $( ""+ this.options.closeBtnText + "" );
```

Is this href="#" really necessary - mobile Safari and desktop browsers appear to manage without it.
If it is required in some circumstances could it optionally created.

In the meantime I have a work around:

```javascript
$($.mobile.dialog.prototype.options.initSelector.live('pagecreate',function(event) {
$('a[href]', this).each(function() {
var self = $(this);
if (self.attr('href')=='#') {
self.removeAttr('href');
}
});
}));
```

but I feel it's a hack and it would be better not to create href="#" in the first place