Click here to Skip to main content
15,891,785 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I read the html file with stream reader and save in string variable
how i can show that variable in new web page
i test it , but not work ...
C#
Response.Write("<script>");
           Response.Write("window.open('"+StrContent.ToString()+"','_blank')");
           Response.Write("</script>");
Posted

1 solution

Use this:
JavaScript
var w = window.open('', '', 'width=400,height=400,resizeable,scrollbars');
w.document.write('Content goes here');
w.document.close(); // needed for chrome and safari


Instead of:
JavaScript
window.open('Content');


Updated:
Change your code to:
C#
Response.Write("<script>");
Response.Write("var w = window.open('', '', 'width=400,height=400,resizeable,scrollbars');");
Response.Write("w.document.write('Content goes here');");
Response.Write("w.document.close();");
Response.Write("</script>");
 
Share this answer
 
v3
Comments
‫محم د‬‎ 13-Aug-14 2:50am    
this error
the name 'window' does not exist in the current context
Trung Nguyen Son 13-Aug-14 2:59am    
Just updated your code. Pls check!
‫محم د‬‎ 13-Aug-14 3:03am    
thanks but jast refresh the page and not work !
this is my code :
Response.Write("<script>");
Response.Write("var w = window.open('', '', 'width=400,height=400,resizeable,scrollbars');");
Response.Write("w.document.write('"+StrContent+"');");
Response.Write("w.document.close();");
Response.Write("</script>");
Trung Nguyen Son 13-Aug-14 3:09am    
Your popup maybe blocked by the browser.
It works fine in my environment.
Check it!
‫محم د‬‎ 13-Aug-14 3:12am    
test it with chrome,firefox,opera !

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900