How to customize /#/ in Jquery address plugin
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?
开发者_StackOverflow社区I would greatly appreciate any help.
Thanks in advance
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:
Include the script with an additional parameter:
Call an API method
$.address.strict(false);
Looking at the documentation, I looks like you can do this:
$('a').address(function() {
return $(this).attr('href').replace(/#\//, '#');
});
This will replace #/ with #.
精彩评论