473,327 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Open new browser session

I have a button on my web app, that opens a help html page. I use this code:
HttpContext.Current.Response.Write("<script>")
HttpContext.Current.Response.Write("window.open('" & sUrl & "','_new')")
HttpContext.Current.Response.Write("</script>")

This works ok, the html page opens in a new browser window, but when I
close the help, click on a different menu item in my app, and then click the
back button, the help window opens up again.

How do I do a Response.Write, that isn't on HttpContext.Current? I have
also tried _blank

Thanks, Leonard
Oct 19 '05 #1
3 3107
Leonard,

You put window.open(url) in the document - and it executes every time the
document is loaded. If you need to open new window when a button is clicked -
just add "onclick" attribute for your button:
MyButton.Attributes.Add("onclick", "window.open('" & sUrl & "','_new')")

"Leonard" wrote:
I have a button on my web app, that opens a help html page. I use this code:
HttpContext.Current.Response.Write("<script>")
HttpContext.Current.Response.Write("window.open('" & sUrl & "','_new')")
HttpContext.Current.Response.Write("</script>")

This works ok, the html page opens in a new browser window, but when I
close the help, click on a different menu item in my app, and then click the
back button, the help window opens up again.

How do I do a Response.Write, that isn't on HttpContext.Current? I have
also tried _blank

Thanks, Leonard

Oct 20 '05 #2
Hi Sergey,
The new window opens ok with the code I have, but it opens on the current
context, so when I press the back button, the new url opens again. I want
the window to open, then when I close it, it is gone and is not re-opened
when I press the back button on the browser

"Sergey Poberezovskiy" wrote:
Leonard,

You put window.open(url) in the document - and it executes every time the
document is loaded. If you need to open new window when a button is clicked -
just add "onclick" attribute for your button:
MyButton.Attributes.Add("onclick", "window.open('" & sUrl & "','_new')")

"Leonard" wrote:
I have a button on my web app, that opens a help html page. I use this code:
HttpContext.Current.Response.Write("<script>")
HttpContext.Current.Response.Write("window.open('" & sUrl & "','_new')")
HttpContext.Current.Response.Write("</script>")

This works ok, the html page opens in a new browser window, but when I
close the help, click on a different menu item in my app, and then click the
back button, the help window opens up again.

How do I do a Response.Write, that isn't on HttpContext.Current? I have
also tried _blank

Thanks, Leonard

Oct 21 '05 #3
Leonard,

not sure what you mean, but if you want to prevent the same window from
loading once you navigated to another page, you can store the values whether
you opened or not your window in a hidden field (let's say on document unload
event) and then read that value during load event and then decide whether to
open or not your help window. I used similar techique to prevent a form from
multiposting when user clicks on "Back" or History link.

HTH

"Leonard" wrote:
Hi Sergey,
The new window opens ok with the code I have, but it opens on the current
context, so when I press the back button, the new url opens again. I want
the window to open, then when I close it, it is gone and is not re-opened
when I press the back button on the browser

"Sergey Poberezovskiy" wrote:
Leonard,

You put window.open(url) in the document - and it executes every time the
document is loaded. If you need to open new window when a button is clicked -
just add "onclick" attribute for your button:
MyButton.Attributes.Add("onclick", "window.open('" & sUrl & "','_new')")

"Leonard" wrote:
I have a button on my web app, that opens a help html page. I use this code:
HttpContext.Current.Response.Write("<script>")
HttpContext.Current.Response.Write("window.open('" & sUrl & "','_new')")
HttpContext.Current.Response.Write("</script>")

This works ok, the html page opens in a new browser window, but when I
close the help, click on a different menu item in my app, and then click the
back button, the help window opens up again.

How do I do a Response.Write, that isn't on HttpContext.Current? I have
also tried _blank

Thanks, Leonard

Oct 24 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Paul | last post by:
I link to a web site from an Excel spreadsheet. The page i link to is getCookie.asp which sets a cookie then returns back some html which opens a new window, to the same site but a different page...
4
by: google | last post by:
Hi there, I've searched high and low for this, but it seems most people are looking to establish (and control) the relationship between a parent browser window and it's associated child window...
5
by: John Scott | last post by:
Ok..this a rather odd question/problem. I haven't really found a straight forward answer to how to handle this scenario, so I hope someone here can help. Here it is: I have an application...
4
by: Gunawan | last post by:
Dear All, I would like to know how to disable 'open in a new tab' or 'open in a new window' feature coz I would like to maintain parameter using session id which is not change if we using those...
9
by: cendrizzi | last post by:
Hi all, I've read some stuff on this but can't seem to come up with a solution that works right. I have a semi-mature (yet very large and robust) internal web application that currently only...
8
by: jaibux | last post by:
Everybody knows how to open (or clone) the same page that you are viewing in a new browser window by CTRL+N or via File->New Window. the question is how to PREVENT to open the SAME WEB APPLICATION...
6
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I am thinking about doing this since I got several cases that some of our internal users open more than one browser at the same time from our server. When one of the transactions was not...
20
by: luqman | last post by:
If user login with the login control in ASP.Net 2005 and then just close the browser and then open the browser again, the login status shows, User still Login? Any idea, how to Logout the User...
3
by: Tomasz J | last post by:
Hello Developers! A lot has been written about Java Script window.open() function and lost session state. But the most recent version of IE seems to handle it correctly. But now I have an...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.