473,386 Members | 1,886 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,386 software developers and data experts.

window.open + asp interfering with browser navigation?

Below are two files: Main.asp and Help.asp.

I've stripped it down to the 'barest-of bones' so that anyone willing to
help can duplicate the problem on their own systems.

***Main.asp*** looks like so:

<HTML>
<HEAD>
<TITLE>Main</TITLE>
</HEAD>
<BODY>
<A HREF="Help.asp" TARGET="Help" OnClick="window.open(this.href,
this.target,'height=100');return false">Help</A>
<!--SPAN STYLE="cursor:pointer"
OnClick="window.open('Help.asp','','height=100')"> Help</SPAN-->
<!--INPUT TYPE="BUTTON" OnClick="window.open('Help.asp',
'Help','height=100')" VALUE="Help"-->
<INPUT NAME="edt1">
<A HREF="Help.asp">Forward</A>
</BODY>
</HTML>

***Help.asp*** looks like so:

<HTML>
<HEAD>
<TITLE>Help</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>

If you call up Main.asp and enter some text in the input field, you can
press the Forward link and navigate back, ad nauseum, without the text
disappearing.

Now, go back to Main.asp. Try clicking the Help button/link. If you then
click on the Forward link
and then navigate back, the previously entered text will have been cleared.

Here's the reason why I reposted this question in this group: Now try
renaming the respective files Main.htm and Help.htm and correct the
corresponding links.

If you repeat the tests all over again, the pages start behaving as
expected: i.e. the text doesn't disappear if/when the Help window gets
created.

My question now is... do I have some flag/setting/parameter somewhere that I
need to toggle. Is there a patch I need to download? Am I calling
window.open wrong? Is this generally acceptable browser behaviour? It's
really starting to bug some of my users. I never really noticed it before -
but now that it's been pointed out to me - it's beginning to bug the heck
out of me as well.

Jul 22 '05 #1
4 2182
Well I notice that if the user closes the popup help.asp window (and
perhaps JavaScript in your Forward link could somehow do that if needed)
and then clicks on the Forward link you provide and then hits the
browser's Back button that the data is still there in the input field.

And here is a snippet of JavaScript code I've used to open the same page
in a new popup window for printing purposes and it closes the window
first just in case the user already opened it once and the popup window
is still "out there" somewhere. This prevents the user starting the
popup again but not seeing anything because the window is already open
(and the focus thus didn't get shifted):

// Dim module-wide global var.
var mwinPrintView;

function jsPrintView() {
// If window already opened from this page, close it.
// Useful for if this opener page opens popup and then user clicks
back on original page.
// This works in browsers incl. AOL.
// For this part to work, the window object must be globally dimmed.
// But doesn't help if user refreshes opener page, or goes to new page
leaving popup still open.
if (window.mwinPrintView) {
mwinPrintView.close();
}

// Open this same file in new window.
mwinPrintView = window.open("<%=
Request.ServerVariables("SCRIPT_NAME") %>?OpenMode=printview",
"printview",
"width=610,innerWidth=610,height=380,innerHeight=3 80,toolbar=yes,directo
ries=no,status=yes,menubar=yes,scrollbars=yes,resi zable=yes,location=yes
");

// Set focus.
// Useful for if this opener page opens popup and then user clicks
back on original page,
// refreshes original page, or goes to new page leaving popup still
open.
// This is ignored by AOL browsers.
mwinPrintView.focus();

// Msg from new window.
mwinPrintView.alert("Landscape orientation is recommended for
printing.");
}

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 22 '05 #2
Thanks for the additional info. I'll give it a try.

So - your gut feel - is this a bug with asp that shouldn't be happening?

It's kind of odd that I can't find any references to it from the usual
sources - and that it took me this long to notice it.

Unfortunately for me, I have quite a few pages that require a not
insubstantial amount of data - so losing user provided input is not good -
and I'm going to need to rethink some of my design decisions. Do you find
yourself not using JScript to open windows, a lot?
Jul 22 '05 #3
<<
Thanks for the additional info. I'll give it a try.

So - your gut feel - is this a bug with asp that shouldn't be happening?

It's kind of odd that I can't find any references to it from the usual
sources - and that it took me this long to notice it.

Unfortunately for me, I have quite a few pages that require a not
insubstantial amount of data - so losing user provided input is not good
-
and I'm going to need to rethink some of my design decisions. Do you
find
yourself not using JScript to open windows, a lot?


I don't think there's an ASP error - just how browsers tend to work or
something perhaps.

I often have JavaScript open a popup window. Some related
considerations I often deal with are that I usually have a Close button
added to the popup (as when the popup is closed it seems like the info
on the original form is always still there).

Also when I have many links on the same page that open a new window I
don't make them all the same target (i.e. they don't all say
target="new". Examples:
<a href"mypage1.asp" target="mypage1">My Page 1</a>
<a href"mypage2.asp" target="mypage2">My Page 2</a>

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 22 '05 #4
Finally scrounged up some time to try out your suggestions... No joy... at
least with my particular browser configuration (fully patched, latest and
greatest version of IE).

Thanks for taking the time to research my problem.

Anybody from MS care to help? I am having a hard time believing that I'm
the only one running into this particular problem.
Jul 22 '05 #5

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

Similar topics

6
by: lukeo | last post by:
I'm shelling out to an .asp (or htm) page from an application. I want to show this in a window without the address bar, etc... Is there a way I can redirect this page using javascript to a page...
13
by: Kai Grossjohann | last post by:
It seems that Ctrl-N in Mozilla opens a new empty browser window. That's fine, I don't need to do anything about it. But Ctrl-N in IE appears to clone the current window. Is there a way to...
3
by: Chris | last post by:
Hi I have designed my website to fit my standard windows. I use a javascript scroller that nescitates the removal of the browser scroll bars. However if a user has an extra toolbar open in...
2
by: Dan Cruz | last post by:
I've got an asp page that kicks-off a JScript window.open on an onClick event (the new window provides informational/help info to supplement the base form). Everything works fine, except... ...
8
by: alanstew | last post by:
With the body tag calling out 'window onload', a function with a 'window.open' fails at the 'window.open' line. If I cut out the body tag, the function executes as normal. At first I thought it...
10
by: Marshall Dudley | last post by:
When I do the following line in Netscape, the popup loads as it should, but the parent window usually, but not always, reloads as well. <a href="#"...
29
by: wayne | last post by:
Hey there... I'm having some problems passing url parameters with an open.window command. I'm not terribly familiar with java script but here is the code below. When executed it opens the...
18
by: len.hartley | last post by:
Hi, I am trying to pop-up a window when the user clicks on an image. The problem is that when the user clicks on the image and the window pops up OK, but the window underneath also proceeds to...
21
by: alistair_henderson | last post by:
Morning All, I have some code for a website which uses 'window.open' to simulate modal dialog boxes. I use the window.closed property to decide if the window object exists at various points. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.