replace history only when unload event happens refs #141

and history replacing function has no relation with websocket, so I separated it from jquery-websocket.js