...

View Full Version : Open a new window???????



jamesbyrne
08-23-2005, 09:07 AM
I need to know how to open a popup window using ASP, I want this to open when the page loads,

Thanks,

James

glenngv
08-23-2005, 01:59 PM
You can only open a new window onload using client-side javascript. ASP has nothing to do with it. ASP doesn't know anything about windows/frames/iframes. That's the job of client-side not server-side.


<script type="text/javascript">
window.onload = function(){
var w = window.open("http://www.google.com", "_google", "width=800, height=600, resizable=1");
w.focus();
}
</script>
BTW, that will be blocked by popup blockers.

jaywhy13
08-23-2005, 07:26 PM
You could also use asp to write out the javascript code... that way you still have some amount of control via your asp code.
For example:

response.write "<script type='text/javascript'>"
response.wirte "window.onload = function(){"
....
response.write "</script>"

And so on.. and so forth....

jamesbyrne
08-25-2005, 07:14 AM
can i make this so it is not blocked by popup blockers

neocool00
08-25-2005, 03:46 PM
I've seen some weird things from new windows created/controlled by Javascript. I have yet to determine what doesn't get blocked by pop-up blockers and what does. I have the google toolbar installed which has it's own pop-up blocker and sometimes when I click on javascript links that open new windows it works and sometimes it doesn't. If I come across one that works (b/c I can't remember one of the top of my head), I'll post the link here for you to check out. Of course, not all pop-up blockers are the same (kind of like browsers ;))

oracleguy
08-25-2005, 07:39 PM
can i make this so it is not blocked by popup blockers

The easiest way is to not make it auto initiated. It won't be blocked if it is the result of the user clicking on a button or link usually.

jaywhy13
08-25-2005, 07:39 PM
I think.. at least from what I've seen from workin on code and using popups. Persistent pop-ups tend to eventually NOT get blocked.. :confused: But i'm still yet to find that out myself... I see it alot with sites that have persistent, annoying popups. Usually google will block the first one or two but after that... they pop away...!!!

jaywhy13
08-25-2005, 07:53 PM
The easiest way is to not make it auto initiated. It won't be blocked if it is the result of the user clicking on a button or link usually.
In my experience... Google blocks windows that are opened after a link is clicked when the onClick triggers a javascript which later opens the window.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum