On-Click A-tag with Href, socket gets disconnected
问题 I am working on a project using socket.io. I want to give user some links to download a file as <a href="<path>" >Link Name</a> When I click on link to download file, my socket gets disconnected. When I use this <a href="<path>" target="_blank">Link Name</a> it works fine. Any reason why this happens? 回答1: When you follow a link within the same window, the current page's environment gets completely torn down, including the entire JavaScript environment in which your code (and socket.io's code