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

window.open + asp interfering with browser navigation?

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


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

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

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

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

Replies have been disabled for this discussion.