By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,393 Members | 1,405 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,393 IT Pros & Developers. It's quick & easy.

Re: Client script not working on XP

P: n/a
"Parrot" <Pa****@discussions.microsoft.comwrote in message
news:D4**********************************@microsof t.com...

Dave,
Thanks to both replies. I found out that the problem is that I have a
popup
blocker set to on for the computers in which the script does not work. I
don't understand this because I have used the following script hard coded
in
another web page and it isn't blocked yet if I use the same script in the
RegisterStartupScript it is blocked. The script code I used is as
follows:

string scriptText = "printWindow = window.open('','','width=400,
height=400');";
scriptText += "printWindow.document.open();";
scriptText += "printWindow.document.write(\"<html><head><body>So me
text</body></html>\");";
scriptText += "printWindow.document.close();";
cs.RegisterStartupScript(this.GetType(), "Testwindow", scriptText, true);
RegisterStartupScript is used to inject JavaScript into web pages - not
write out HTML.
http://msdn.microsoft.com/en-us/library/z9h4dk8y.aspx

By the way, you *really* are in the wrong newsgroup now...
If I change true to false in the RegisterStartupScript argument, nothing
displays at all.
The boolean override controls whether RegisterStarupScript creates the
opening and closing JavaScript <scripttags...
So my question is how can I write the script so it can bypass a popup
blocker?
You can't like this - that's what popup blockers are for!

You need something like this:
http://www.asp.net/ajax/ajaxcontrolt...odalpopup.aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 30 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Mark;

I did post my question onto another forum. I can understand why popup
blockers will stop my script but why does it not stop the script that is hard
coded in another web page that I have successfully executed without being
blocked.
Dave

"Mark Rae [MVP]" wrote:
"Parrot" <Pa****@discussions.microsoft.comwrote in message
news:D4**********************************@microsof t.com...

Dave,
Thanks to both replies. I found out that the problem is that I have a
popup
blocker set to on for the computers in which the script does not work. I
don't understand this because I have used the following script hard coded
in
another web page and it isn't blocked yet if I use the same script in the
RegisterStartupScript it is blocked. The script code I used is as
follows:

string scriptText = "printWindow = window.open('','','width=400,
height=400');";
scriptText += "printWindow.document.open();";
scriptText += "printWindow.document.write(\"<html><head><body>So me
text</body></html>\");";
scriptText += "printWindow.document.close();";
cs.RegisterStartupScript(this.GetType(), "Testwindow", scriptText, true);

RegisterStartupScript is used to inject JavaScript into web pages - not
write out HTML.
http://msdn.microsoft.com/en-us/library/z9h4dk8y.aspx

By the way, you *really* are in the wrong newsgroup now...
If I change true to false in the RegisterStartupScript argument, nothing
displays at all.

The boolean override controls whether RegisterStarupScript creates the
opening and closing JavaScript <scripttags...
So my question is how can I write the script so it can bypass a popup
blocker?

You can't like this - that's what popup blockers are for!

You need something like this:
http://www.asp.net/ajax/ajaxcontrolt...odalpopup.aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 30 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.