Hi,
I really should validate a string like this
index/index/page/4/slug/myseoslug
from a hash (I’m using history jquery plugin)
#index/index/page/2/slug/secondo?&_suid=1341580203178011306333182273698
History.Adapter.bind(window,'load',function(){
var hash = History.getHash();
if(hash.length > 0){
var tmp = validateHash(hash);
if(typeof tmp === 'string'){
log(tmp);
}
}
});
function validateHash(hash){
var url = hash.split('?',2)[0];
if(url.indexOf('index/index/page') !== -1){
var chunks = url.split('/',6);
return chunks.slice(2, 6).join('/');
}
return false;
}
Is there a better way ?
Thanks in advance.