By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,078 Members | 2,164 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,078 IT Pros & Developers. It's quick & easy.

Open new browser session

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.