views:

137

answers:

2

Hi,

I'm using the Jquery plugin Address to achieve deep linking.

The generated urls come out in the format www.example.com/#/tab/image, but what I need is www.example.com/#tab/image. The plugin seems to automatically generate the /#/ part.

I wonder does anyone know how to do this? Or even if it's possible?

I would greatly appreciate any help.

Thanks in advance

+1  A: 

Looking at the documentation, I looks like you can do this:

$('a').address(function() {  
     return $(this).attr('href').replace(/#\//, '#');  
});

This will replace #/ with #.

edwin
Thanks so much for the suggestion, but unfortunately it doesn't seem to work! When I include it in my script it just seems to bugger up the history and the links I'm generating in unusual ways, but never changes the /#/ part of the url. Maybe I'm calling it in the wrong place, or I've done something manually to interfere with it (I'm a relative newbie at Jquery).I saw the snippet on the documentation alright, but obviously didn't understand the explanation of what it is for! Thanks again
Lauren
+2  A: 

There is a plugin setting called "strict mode" that enforces the additional slash that you want to remove. You can do it in two ways:

  1. Include the script with an additional parameter:

  2. Call an API method

    $.address.strict(false);

Rostislav
That works perfectly! Thank you so much, greatly appreciated!
Lauren