Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you make a webpage open in a new window?

Status
Not open for further replies.

Dross

Programmer
Aug 16, 2001
212
US
I have Crystal 8 and have a field that I want to hyperlink to another application, but I want that new app to open in it's own window. I am using Crystals Active X viewer. I have the link working correctly, just not opening in a new window. Any ideas??
 
You can use a java script window.open function to pop up a new window. Here is a little sample:

<head>
<script language=&quot;javascript&quot;>
function openReportWindow(){
window.open(&quot;reportPage.asp&quot;, &quot;toolbar=1, scrollbars=1, status=1, resizable=1, width=500, height=500, left=0&quot;);
}
</script>
</head>
<body>
<a href=&quot;javascript:eek:penReportWindow()&quot;>Click to view report</a>
</body>
</body>
 
Dross : Did you ever resolve this issue?? I have the same problem I.E. I have a report, I want to add a formula (hyperlink) to a field on the main report that opens an HTML page in a new window.. The Javascipt won't work as there is no way to enter that (Javascript) in a CR Link Formula..

Rich..
 
No, never really resolved it. I have over 1,000 customers and I have to make sure they are all on IE 6 and their browser is set to always open in a new window. It is a nightmare to keep track of who did it and who didn't, but that is the only way to make sure it opens in a new browser. Hope that helped.
 
here's one idea that would be kinda tough, but doable.

At the beginning of your ASP page that loads the report, check to see if any parameters (request objects) have been sent in and set Session variables equal to these parameters.
Throughout the rest of your page, use these Session variables to populate your report.

<%
if request(&quot;parm1&quot;) <> &quot;&quot; then
Session(&quot;parm1&quot;) = request(&quot;parm1&quot;)
end if

Report.Parameterfields.item(1).setCurrentValue(Session(&quot;parm1&quot;))
%>

For your hyperlinks, point them to this same exact ASP report page (which they should already be a part of) and include something like:
loadReport.asp?newWindow=
Back to your ASP Report page:
Just before the <body> tag, check to see if there's something in this part of the querystring, and then run the javascript LV posted accordingly.

So your code looks something like this:

<head>
<script language=&quot;javascript&quot;>
function openReportWindow(strNewWindow){
window.open(&quot; & strNewWindow, &quot;toolbar=1, scrollbars=1, status=1, resizable=1, width=500, height=500, left=0&quot;);
Page_Initialize();
}
</script>
</head>
<%if request(&quot;newWindow&quot;) <> &quot;&quot; then%>
<body onload=&quot;javascript: openReportWindow('<%=request(&quot;newWindow&quot;)%>');&quot;>
<%else%>
<body onload=&quot;vbscript: Page_Initialize()&quot;>
<%end if%>


Now, the other trick is that when you're submitting the report from a different ASP page for the first time, you'll have to check those Session variables that store the parameter values and clear them out if need be before you try to load the report.

<%
if Session(&quot;parm1&quot;) <> &quot;&quot; then
Session(&quot;parm1&quot;) = &quot;&quot;
end if
%>

<a href=&quot;loadReport.asp?parm1=firstValue&quot;>Click here to see the report</a>

Hope this works for ya.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top