Solved

Popup window and history.back

Posted on 2004-04-07
6
866 Views
Last Modified: 2012-08-14
I have a JSP page page1.jsp which posts on another JSP page page2.jsp,
On page1.jsp there is a button that opens a popup window, when user submits page1 he can view a summary on page2 and can click back to change information, back is history.back, when he goes to page1.jsp all the data is there, unless he has clicked on the button to open the popup window on page 1 in this case when he clicks on back the data is gone
0
Comment
Question by:ko78
  • 2
6 Comments
 
LVL 7

Expert Comment

by:TheKenman
ID: 10773359
Hi ko78,

Can I see a sample of your code?

Thanks.
0
 

Author Comment

by:ko78
ID: 10773484
<Script      language="javascript">
function drawbutton(name,link){
      document.write("<table cellpadding=0 cellspacing=0 class=button height=16><tr><td width='4' background='/PMResources/images/en/itworx/hedge2/btn_left.gif'></td><td nowrap background='/PMResources/images/en/itworx/hedge2/btn_middle.gif'><a class=button href='"+link+"'>"+name+"</td><td width=5 background='/PMResources/images/en/itworx/hedge2/btn_right.gif'></td></tr></table>");
}
function SearchForUser(){
      var features = 'top=0,left=0,width=480,height=300,toolbar=no, menubar=no, scrollbars=no, resizable=yes,location=no, directories=no, status=no'
      var url = "/NASApp/pae/Loan_Request.npm?eventId=Itworx.SearchFieldUIEventHandler&__FieldName=SearchByName&__NodeName=Saved&boxValue=" + document.forms[0].SearchByName.value + "&__rand=" + (new Date()).getTime()
      var w = window.open(url,'FX_Search',features);
      w.focus();
}
</Script>


And this is written in the HTML
<td>
<script language="javascript">
drawbutton('SEARCH','javascript:SearchForUser()')
</script>
</td>

and the back button in page2 is

<td>
<script      language = "javascript">                                    
drawbutton("BACK","javascript:window.history.back();")
</script>
</td>
0
 
LVL 4

Accepted Solution

by:
tenacium earned 200 total points
ID: 10778580
My recommendation is when you click "change information", don't send them a browser "back" command.  Instead, bring them to JSP1 again and pass all the information again pre-populated.  It's much more reliable and improves user experience.  Since you pass the information from JSP1 to JSP2, I assume you know how to do it and it won't be that difficult to implement.  It's difficult to know what end-users are doing with their browsers and how that may affect your back button command.
0
 
LVL 7

Expert Comment

by:TheKenman
ID: 10778628
I agree.

When the pop-up is opened it takes the place of the 1st page in the browser history. Working around this would be much harder - and more likely to fail - than implementing data persistence.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now