new windows popup blocker

J

Jachu

Hi, when i want to open in a new windows a url, use this code.

Private Sub btnF_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnF.Click
Response.Write("<script>")
Response.Write("window.open('http://www.hotmail.com','_blank')")
Response.Write("</script>")
End Sub

I don't want that the new windows popup blocker, stop this process. Any
idea?
 
M

Marina

The popup blocker is there for a reason - to stop popups. And it is doing
what it is supposed to.

Your users will have to turn it off in order for your application to work
the way you designed it.
 
S

Selden McCabe

Yes, this type of code is blocked by many popup blockers.

You can get around this by using client-side script.

Choice 1: embed the script in the aspx page

Choice 2: set the script in code-behind by doing something like this:

btnButton.Attributes.Add("onClick","window.open('http://www.hotmail.com','_blank')")

I prefer choice #2 since it helps keep all your code in one place.

Good luck!

---Selden
 
J

Jachu

Thanks Selden, choice #2 work !!!!!.

Selden McCabe said:
Yes, this type of code is blocked by many popup blockers.

You can get around this by using client-side script.

Choice 1: embed the script in the aspx page

Choice 2: set the script in code-behind by doing something like this:

btnButton.Attributes.Add("onClick","window.open('http://www.hotmail.com','_blank')")

I prefer choice #2 since it helps keep all your code in one place.

Good luck!

---Selden
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top