Connecting Tech Pros Worldwide Forums | Help | Site Map

window.open & RegisterClientScriptBlock

Guest
 
Posts: n/a
#1: Jul 11 '07
Hello,

I try to open a new Window in code behind with :
ClientScript.RegisterClientScriptBlock(this.GetTyp e(), "MyOpenScript",
"window.open('toto.doc');", true);

My problem is that the new window is created but it disappears immediatly
just after creation!!

For information, I tried this:

ClientScript.RegisterClientScriptBlock(this.GetTyp e(), "MyOpenScript",
"window.location=''toto.doc';", true);

IE7 ask me to validate the download in the top of the browser (it is a
security message that we have to validate to continue...)

I tried also this:

ClientScript.RegisterClientScriptBlock(this.GetTyp e(), "MyOpenScript",
"window.open(Image.jpg');", true);

I have a new Window with my image!

In fact, it doesn't work with files that need to have the validation message
(open, save to disk, cancel)

How can I download these kind of files ?

Thanks,

David.



nahid
Guest
 
Posts: n/a
#2: Jul 11 '07

re: window.open & RegisterClientScriptBlock


On Jul 11, 5:13 am, <Davidwrote:
Quote:
Hello,
>
I try to open a new Window in code behind with :
ClientScript.RegisterClientScriptBlock(this.GetTyp e(), "MyOpenScript",
"window.open('toto.doc');", true);
>
My problem is that the new window is created but it disappears immediatly
just after creation!!
>
For information, I tried this:
>
ClientScript.RegisterClientScriptBlock(this.GetTyp e(), "MyOpenScript",
"window.location=''toto.doc';", true);
>
IE7 ask me to validate the download in the top of the browser (it is a
security message that we have to validate to continue...)
>
I tried also this:
>
ClientScript.RegisterClientScriptBlock(this.GetTyp e(), "MyOpenScript",
"window.open(Image.jpg');", true);
>
I have a new Window with my image!
>
In fact, it doesn't work with files that need to have the validation message
(open, save to disk, cancel)
>
How can I download these kind of files ?
>
Thanks,
>
David.
hi,
try this from code behind hope help

//Set the appropriate ContentType.
Response.ContentType = "Application/doc";
//Get the physical path to the file.
string FilePath = MapPath("s.doc");
//Write the file directly to the HTTP content output stream.
Response.WriteFile(FilePath);
Response.End();

nahid
http://nahidulkibria.blogspot.com/
http://www.kaz.com.bd

Guest
 
Posts: n/a
#3: Jul 11 '07

re: window.open & RegisterClientScriptBlock


Hi,

Sorry but I have an error message on my page :
The XML page can't be displayed ...

A bad caracter has been found in a text content...

More, I want to open a new window with the content file inside, not the the
page itself.

In fact, this code could work :
ClientScript.RegisterClientScriptBlock(this.GetTyp e(), "MyOpenScript",
"window.open('toto.doc');", true);

Maybe a parameter in IE7 to change ?
Why my new page begins to be displayed and disappears immediatly ?
Why does it work with a text file or an image file ?

Thanks in advance,
David.


"nahid" <nahidupa@gmail.coma écrit dans le message de news:
1184109520.614184.297890@n2g2000hse.googlegroups.c om...
Quote:
On Jul 11, 5:13 am, <Davidwrote:
Quote:
>Hello,
>>
>I try to open a new Window in code behind with :
>ClientScript.RegisterClientScriptBlock(this.GetTy pe(), "MyOpenScript",
>"window.open('toto.doc');", true);
>>
>My problem is that the new window is created but it disappears immediatly
>just after creation!!
>>
>For information, I tried this:
>>
>ClientScript.RegisterClientScriptBlock(this.GetTy pe(), "MyOpenScript",
>"window.location=''toto.doc';", true);
>>
>IE7 ask me to validate the download in the top of the browser (it is a
>security message that we have to validate to continue...)
>>
>I tried also this:
>>
>ClientScript.RegisterClientScriptBlock(this.GetTy pe(), "MyOpenScript",
>"window.open(Image.jpg');", true);
>>
>I have a new Window with my image!
>>
>In fact, it doesn't work with files that need to have the validation
>message
>(open, save to disk, cancel)
>>
>How can I download these kind of files ?
>>
>Thanks,
>>
>David.
>
hi,
try this from code behind hope help
>
//Set the appropriate ContentType.
Response.ContentType = "Application/doc";
//Get the physical path to the file.
string FilePath = MapPath("s.doc");
//Write the file directly to the HTTP content output stream.
Response.WriteFile(FilePath);
Response.End();
>
nahid
http://nahidulkibria.blogspot.com/
http://www.kaz.com.bd
>

Guest
 
Posts: n/a
#4: Jul 11 '07

re: window.open & RegisterClientScriptBlock


In fact, I have to encode as "application/msword"

It works but I still want to create a new window...

If I use the code Response.WriteFile in a second webpage and I call it from
my startpage with RegisterClientScriptBlock and window.open, the problem is
still here!
I hear the sound like IE blocks a new popup window even if I authorize IE...

What can I do else?
Thanks.

<Davida écrit dans le message de news:
eo9iAH%23wHHA.2040@TK2MSFTNGP03.phx.gbl...
Quote:
Hi,
>
Sorry but I have an error message on my page :
The XML page can't be displayed ...
>
A bad caracter has been found in a text content...
>
More, I want to open a new window with the content file inside, not the
the page itself.
>
In fact, this code could work :
ClientScript.RegisterClientScriptBlock(this.GetTyp e(), "MyOpenScript",
"window.open('toto.doc');", true);
>
Maybe a parameter in IE7 to change ?
Why my new page begins to be displayed and disappears immediatly ?
Why does it work with a text file or an image file ?
>
Thanks in advance,
David.
>
>
"nahid" <nahidupa@gmail.coma écrit dans le message de news:
1184109520.614184.297890@n2g2000hse.googlegroups.c om...
Quote:
>On Jul 11, 5:13 am, <Davidwrote:
Quote:
>>Hello,
>>>
>>I try to open a new Window in code behind with :
>>ClientScript.RegisterClientScriptBlock(this.GetT ype(), "MyOpenScript",
>>"window.open('toto.doc');", true);
>>>
>>My problem is that the new window is created but it disappears
>>immediatly
>>just after creation!!
>>>
>>For information, I tried this:
>>>
>>ClientScript.RegisterClientScriptBlock(this.GetT ype(), "MyOpenScript",
>>"window.location=''toto.doc';", true);
>>>
>>IE7 ask me to validate the download in the top of the browser (it is a
>>security message that we have to validate to continue...)
>>>
>>I tried also this:
>>>
>>ClientScript.RegisterClientScriptBlock(this.GetT ype(), "MyOpenScript",
>>"window.open(Image.jpg');", true);
>>>
>>I have a new Window with my image!
>>>
>>In fact, it doesn't work with files that need to have the validation
>>message
>>(open, save to disk, cancel)
>>>
>>How can I download these kind of files ?
>>>
>>Thanks,
>>>
>>David.
>>
>hi,
>try this from code behind hope help
>>
>//Set the appropriate ContentType.
> Response.ContentType = "Application/doc";
> //Get the physical path to the file.
> string FilePath = MapPath("s.doc");
> //Write the file directly to the HTTP content output stream.
> Response.WriteFile(FilePath);
> Response.End();
>>
>nahid
>http://nahidulkibria.blogspot.com/
>http://www.kaz.com.bd
>>
>
>

Closed Thread