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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want to window.print then redirect

Status
Not open for further replies.

RandyBlackburn

Programmer
Oct 1, 2002
153
US
I'm trying to automatically prompt the user to print the already rendered page, then redirect to another page.

I can't get window.location to work at all, though window.open works.

If I use response.write to write the javascript, the page has not yet rendered.

If I use
script = "<script language='javascript'>window.print();window.open('
it ignores the window.print, and of course opens a new window

I suppose I could do this by putting an additional button on the page to do the redirect, but it's not ideal.

Any suggestions would be appreciated

Randy
 
You can use the RegisterStartUpScript to register any javascript that you want to run when the page loads.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I was hoping you'd be in bright and early. By the way my wife is Irish, and I lived in London many years ago

Here is the full code...
Code:
        Dim script As String
        script = "<script language='javascript'>window.print();window.open('[URL unfurl="true"]http://xxx');</script>"[/URL]
        Page.RegisterStartupScript("show", script)

it look like it won't let me do a window.print if I also do a window.open... is there a way to introduce a delay to make it pause...

It WILL let me do a window.print and an alert

Randy
 
By the way, I'm doing this in the pageLoad event... is that the best approach?
 
Yeah, javascript has a window.setTimeout method that would allow to to insert a pause. However, I think you should take this question to the javascript forum as they will be more suited to helping you write the function. Once you've got that bit done, you can just register exactly like you've done above.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top