473,385 Members | 1,478 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,385 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 3109
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...
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: 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
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.