Fragment URL transformation
I have the BBQ plugin working already, so this is just a cosmetic change. I have no idea how to transform the URL from /index.html#pages/index开发者_如何学运维.html
to just /index.html#index
It's basically a fragment transformation I guess, but am very new to JS. Any thoughts?
You can access the hash just using window.location.hash and it returns a string so you can do whatever string manipulation you like on it. For Example:
var temp = window.location.hash; // == #pages/index.html
temp = temp.replace("pages/","").replace(".html","");
window.location.hash = temp; //sets the hash to #index
精彩评论