I have created an SPA through CRA, and a modal of the app runs the following command to download a PDF generated from SSRS when a button on it has been clicked.
window.open("SSRS server URI that generates a PDF", "_blank")
Now, when the code above is run with npm start (development mode) along with the backend that is running on the ASP.NET Core web server, the new tab is opened and the PDF is downloaded when the button is clicked. Regardless the number of time I clicked the button, the tab is opened and the PDF is downloaded, even if the PDF is the same.
However, when the code is built with npm run build (production mode) and served by the ASP.NET Core web server, the new tab is opened, but the PDF is downloaded during the first time, subsequent click on the button opens the new tab without the PDF being downloaded. Interestingly, this happens on Chrome, but not Chromium Edge.
Does any one have any idea what could have caused such odd behaviour when running the SPA in production mode?