I opened the screen I created on asp.net(VB) in safari on my iPhone.
I would like to delete the tab when I press the "Exit" button."
"When I press the button, a window appears and says ""Exit"" but
"
"When I press ""Close"", the tab does not disappear, and I just return to the original screen."
Designer side programs
<div>
<asp:Button ID="btn_terminate" runat="server" Text="Exit" CssClass="button_shared_preference"/>
</div>
Code Side Programs
Protected Subbtn_terminate_Click (sender As Object, eAs EventArgs) Handles btn_terminate.Click
ClientScript.RegisterClientScriptBlock(Me.GetType(), "key", "window.alert('Exit''); window.close(), True)
End Sub
Supplemental 2022-02-18
Here is the general flow of the work.
1. Access the site by loading QR with URL with iPhone camera
No special action is taken when loading the site
2. Check and input within the site
*It's not important, so I'll skip the details.
3. Press the "Exit" button to export the contents to the server and close the displayed window
The window you see is a site that you accessed with "1" and you ran through with "2".
"The problem is the ""Close Window"" part.
Export to the server has been implemented.
Don't you know what will happen with iPhone Safari or something like that, but don't you usually close it with a browser like that kind of script? JavaScript should only be able to close windows open in JavaScript.
追Additional note 2022/2/18 10:35 】
"It seems that ""Supplemental 2022-02-18"" has been added to the question section, so I will add a response to that below."
1. Access the site by loading QR with URL with iPhone camera
No special action is taken when loading the site
I understand that it is probably the same as entering the URL of the page in question in the address bar of the browser and making a GET request.If that's the case, in the article introduced by Kunif in the question section,
window.open('about:blank','_self').close();
There seems to be no other way, but whether or not it can be closed as expected depends on the browser.I don't know what will happen with iPhone Safari because I don't have that environment.Why don't you give it a try?
By the way, I tried it in my environment, but only IE11, Firefox 97.0.1 was closed.
Chrome 98.0.4758.102, Edge 98.0.1108.56, Opera 84.0.4316.14 seem to ignore the close, leaving open about:blank.
If you can't use the above script in Safari on your iPhone, I recommend that you give up such a back-to-back approach and think about it in a direct way so that users can manipulate and close it themselves.
596 GDB gets version error when attempting to debug with the Presense SDK (IDE)
884 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
567 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
606 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.