Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-05-2004, 11:42 AM   PM User | #1
cyphix
Regular Coder

 
Join Date: Apr 2004
Posts: 682
Thanks: 24
Thanked 1 Time in 1 Post
cyphix is an unknown quantity at this point
Opening new windows

I want to open a link in a new window but I want to size the window & take away scrollbars etc etc .. is there a way to do this without it getting blocked by popup stoppers?

I have working code for this now but I'm thinking it will get blocked by popup stoppers.... all I need is a custom sized window to open when a user clicks a link without it getting blocked by popup stoppers.

Any help?

Thanks!
cyphix is offline   Reply With Quote
Old 06-05-2004, 12:18 PM   PM User | #2
bherrington
New Coder

 
Join Date: Mar 2004
Location: UK
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
bherrington is an unknown quantity at this point
I'm afraid the whole idea behind pop-up blockers is to block pop-ups. As what you are wanting to do is to open a pop-up, I'm afraid you're going to find life difficult (for difficult, read "impossible"). After the code to open your pop-up you could put in something like;

if(!pop-upwindowname){alert("Your PC does not appear to be allowing a pop-up window to open, possibly because you are using software to block unwanted pop-ups. This page will display, but unless you disable your pop-up blocker software temporarily, you may lose functionailty, or be unable to access features on this page.\n\nThe software might be bypassed by pressing and holding the 'Ctrl' key whilst clicking on hyperlinks or buttons that open new windows.")}
__________________
BRUCE
bherrington is offline   Reply With Quote
Old 06-05-2004, 12:59 PM   PM User | #3
cyphix
Regular Coder

 
Join Date: Apr 2004
Posts: 682
Thanks: 24
Thanked 1 Time in 1 Post
cyphix is an unknown quantity at this point
Hmmmm..... well I just downloaded & installed one of the most popular popup blockers to see if it blocked the current way I am doing it & it didn't block it heh

The code I am using in the <head> </head> tags is..

Code:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=225,left = 200,top = 64');");
}
// End -->
</script>
Then in the link:

Code:
<a href="javascript:popUp('select.html')" >
cyphix is offline   Reply With Quote
Old 06-05-2004, 02:46 PM   PM User | #4
bherrington
New Coder

 
Join Date: Mar 2004
Location: UK
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
bherrington is an unknown quantity at this point
That's because pop-up blockers aren't perfect. You'll find that most block some of the pop-ups some of the time, while a very few block most pop-ups most of the time, however none block all of the pop-ups all of the time. If the one you're using doesn't block your particular pop-up, don't bank on every visitor to your website using the same program.
__________________
BRUCE
bherrington is offline   Reply With Quote
Old 06-05-2004, 03:11 PM   PM User | #5
cyphix
Regular Coder

 
Join Date: Apr 2004
Posts: 682
Thanks: 24
Thanked 1 Time in 1 Post
cyphix is an unknown quantity at this point
Good Advice!
cyphix is offline   Reply With Quote
Old 06-05-2004, 05:45 PM   PM User | #6
the_bob
New Coder

 
Join Date: Dec 2003
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
the_bob is an unknown quantity at this point
with my PUB, when i click a link twice it will pop-up the second time.
try making a link that makes the same window apear twice
...though that may be innoying for people withput PUBs
the_bob is offline   Reply With Quote
Old 06-07-2004, 06:18 AM   PM User | #7
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
Quote:
Originally Posted by cyphix
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=225,left = 200,top = 64');");
}
[/code]
The eval statement is not necessary. Search this forum for eval and you'll find that it is evil
If you want a dynamic global variable, you can use this technique:

window["page" + id] = window.open(URL, id, 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=225,left=200,t op=64');
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:54 PM.


Advertisement
Log in to turn off these ads.