Why
$(function () {
$(window).bind(\'popstate\', function () {alert(\'pop\');});
window.history.pushState(null, \'\', \'/foo\');
});
Don't know exactly what you where trying to achieve but if you simply want your popState Event Handler to launch you can simply extract it out to a function like below :
function popStateHandler(event) {
// Event handling Code here
}
window.onpopstate = popStateHandler;
Then you can simply call your popStateHandler after you pushState.