|
-
Apr 27th, 2004, 04:10 PM
#1
Thread Starter
Hyperactive Member
Closing a browser?
How do I code (VB) a button web control so that when it is pressed, it would close the browser? It is basically doing the same thing as when you click on the "X" button on the upper right hand side corner of IE.
TIF
-
Apr 27th, 2004, 06:21 PM
#2
I wonder how many charact
When it was time to close the window, the control would use
VB Code:
Me.Page.RegisterStartUpScript("blah", myjavascriptclose)
Private Function myjavascriptclose() As String
dim s as String = "<script type=""javascript"">self.close();</script>"
As soon as the page posts back to the client, it will close the browser window.
btw: The script in myjavascriptclose may be wrong and will give you a javascript error when the page loads, but you can search the internet for the proper script.
-
Apr 28th, 2004, 08:06 AM
#3
Thread Starter
Hyperactive Member
Thank for your reply. I tried the code but I can't see this RegisterStartUpScript as an option for the me.page. If I type it in, it gets an underline.
Anyway, I did some research and I found that I can use this code on the page_load event.
VB Code:
Button1.Attributes("onclick") = "return window.close();"
It does the trick (closes the browser) but some issues for my use:
(1) There's always a prompt that informs user that the browser is being closed. How not to show this?
(2) Does not work when used in frames. Amy ideas how to use the code to close a FRAMED page?
TIF
-
Apr 29th, 2004, 07:01 AM
#4
I wonder how many charact
The prompt you cannot get around, unless you first open a blank window for your web app, then use window.open(), and use that script inside the second window that was opened. Because you programatically opened the second window, your code can have permission to close it.
Basically, if there is only one browser window... and it is trying to close, most browsers warn the user that page is trying to close.
I don't use frames in my apps, so I wouldn't know how to solve that problem. To me, there is really no reason to use frames ever, so don't bother implementing them.
-
May 2nd, 2004, 08:26 PM
#5
Frenzied Member
what about the fact the using a menu frame and a content frame means you only have one menu file? or the fact that it hides the information about the page being viewed from the user browsing the site? or what if you want to provide a gui the streatches with browser and works for netscape and ie? or....
Magiaus
If I helped give me some points.
-
May 3rd, 2004, 06:56 AM
#6
I wonder how many charact
The concern I would have about developing frames is the security accesses the up-level browsers are putting between frames, and especially now that IE6 is getting an upgrade with the release of XP SP2, which puts further security restrictions on what you can do between frames.
As far as side-menu's and only having one menu file, you can still use custom or composite controls for the side-menu (as I know you are aware), and use styled tables to place the menus, banners, and main content. And you can still cache the side-menu control in effect giving you frame functionality, albeit on the server side, where its more secure and more easily managed.
(edit): found the list of changes that will affect web programmers developing toward the next version of IE6:
http://www.microsoft.com/technet/pro.../sp2brows.mspx
Last edited by nemaroller; May 3rd, 2004 at 07:09 AM.
-
May 3rd, 2004, 10:19 AM
#7
Frenzied Member
Most of that sounds like a good idea.
Magiaus
If I helped give me some points.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|