2011-04-19 84 views
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 
     } 

    }); 

如何使用#!代替#

回答

1
$.address.crawlable(true); 

使用在你的init事件使所有的##!自动,我装矿的$(document).ready事件

我希望这可以帮助其他人同样的问题

0

#的实例替换为#!