0
我正在使用jquery地址插件,现在我的网址就像http://localhost:3000/#/users/1/
。我希望它根据http://code.google.com/web/ajaxcrawling/index.html的指导原则使用#!
而不是#
。添加#!到jQuery地址
这里是我的JS:
$('.likable').find('a').click(function(e) {
$.address.value($(this).attr('href').replace(/^#/, '').replace('http://'+document.domain,''));
e.preventDefault();
});
$('.ui-show').find('.close').live('click', function(e) {
history.back();
e.preventDefault();
});
// Setup jQuery Address Listener
$.address.init(function(event) {
if ($.address.baseURL() != 'http://' + document.domain) {
if (location.href.indexOf('#') < 0) {
// URL has no hash value and is a permalink, e.g. /about/
// Change address value to that of permalink
var fullpath = location.href.split('/',4);
$.address.value(fullpath[3] + '/');
}
}
}).change(function(event) {
if (event.value != '/') {
$.get($.address.value(),function(data) {
// Insert new content
});
} else {
// Remove new content
}
});
如何使用#!
代替#
?