try this code,
var separator = (window.location.href.indexOf("?")===-1)?"?":"&";
window.location.href = window.location.href + separator + "ts=true";
EDITS:
to avoid duplicated parameter or very large string in your url, you need to replace the old param it already exists.
var url=window.location.href,
separator = (url.indexOf("?")===-1)?"?":"&",
newParam=separator + "ts=true";
newUrl=url.replace(newParam,"");
newUrl+=newParam;
window.location.href =newUrl;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…