I created a QR code that invokes a pure PHP page to perform database updates. I currently testing with the iPhone camera and it does trigger backend operations as expected. The question is when the QR code is scanned, it brings up a blank page. Is it possible to close this blank page by itself at the end of back-end operations or at least not to open a new blank page every time but remain on the same blank page for every new scan?
My Answer:
To prevent the blank page from opening every time the QR code is scanned, you can use JavaScript to close the window after the backend operations are completed. Here's an example of how you can achieve this:
1. Add the following JavaScript code to your PHP page:
javascript
2. Place this code at the end of your PHP page, after the backend operations have been completed.
3. This code will automatically close the window after 3 seconds (you can adjust the time delay as needed) once the backend operations are finished.
By using this approach, the blank page will automatically close after the backend operations are completed, preventing multiple blank pages from opening every time the QR code is scanned.
Rate this post
5 of 5 based on 9460 votesComments