HTML Pop-Up Window

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
Majoraslayer
Forum Commoner
Posts: 64
Joined: Thu Jun 30, 2005 11:50 am
Location: In Your Mind...
Contact:

HTML Pop-Up Window

Post by Majoraslayer »

Is there a way to make a pop-up window that pops up when the user opens the page, written completely in HTML? I can't use Javascript or anything else that would require editing the header because I'm working on a personal MOD for phpBB. So, the header has already been sent by phpBB's scripts and I'm not sure where from. I just need a pop-up window that pops up automatically without Javascript etc. if at all possible. Thanks for any help or suggestions. :D
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Re: HTML Pop-Up Window

Post by neophyte »

Majoraslayer wrote:Is there a way to make a pop-up window that pops up when the user opens the page, written completely in HTML?
None that I know of...

The phpBB template engine spits out output as it goes. So if it needs to be done before headers it needs to be done during or before /includes/header.php is included.

If you want a pop-up window gotta use JS.
Majoraslayer
Forum Commoner
Posts: 64
Joined: Thu Jun 30, 2005 11:50 am
Location: In Your Mind...
Contact:

Post by Majoraslayer »

Since its header information, I should theoretically be able to include it via PHP echo before everything else in the script, correct?

Actually, I'm taking a shot in the dark and guessing that I should be able to add it to the header template file that the admin pages read from. There's only one problem.....I don't know what file that is, and I don't know how to skin phpBB's admin pages with it! I know you can skin over a regular page by simply including page_header.php, but the ACP of 2.0.18 doesn't seem to be as simple >_<.
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Post by foobar »

It doesn't matter what happens in the header, it doesn't affect your browser in any way. What I mean by that is that you can't make any client-side changes with server-side code. You _must_ use JS to open a new window or do anything on the client-side, for that matter. I'm sure you could fiddle around with phpbb's JS code so it would do what you want it to.
Majoraslayer
Forum Commoner
Posts: 64
Joined: Thu Jun 30, 2005 11:50 am
Location: In Your Mind...
Contact:

Post by Majoraslayer »

Well, the main reason I'm concerned about where to put the code is a server side "Headers Already Sent" error. I know it won't affect the client side, other than in most cases the users would see the error at the top of the page.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Majoraslayer wrote:Well, the main reason I'm concerned about where to put the code is a server side "Headers Already Sent" error. I know it won't affect the client side, other than in most cases the users would see the error at the top of the page.
Why would you get headers already sent errors if you're writing a mod for phpBB?

You'll only see those errors if you are trying to set HTTP headers using header() or session_..() etc...

JavaScript doesn't intefere with the headers, it just redirects the browser location elsewhere.

Perhaps if you explain exactly what you need to acheive we'll figure it out ;)
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

my guess is that you're echoing something or sending something down to the client before php is trying to send headers down...

are you doing something on a page that "redirects"?
User avatar
AKA Panama Jack
Forum Regular
Posts: 878
Joined: Mon Nov 14, 2005 4:21 pm

Post by AKA Panama Jack »

Majoraslayer wrote:Well, the main reason I'm concerned about where to put the code is a server side "Headers Already Sent" error. I know it won't affect the client side, other than in most cases the users would see the error at the top of the page.
You can use javascript to initiate a popup window anywhere in the body of the html page. You are not required to place javascript in the header.

Code: Select all

<script language="Javascript" type="text/javascript">
<!--
	window.open('/newprivatemessages.php', '_privatemsg', 'HEIGHT=225,resizable=yes,WIDTH=400');
//-->
</script>
The above will cause a 400 pixel wide, 225 pixel wide window to open and execute the newprivatemessages.php program through that window. The script can be placed anywhere in the main body of the html page and it will open a popup window.
Majoraslayer
Forum Commoner
Posts: 64
Joined: Thu Jun 30, 2005 11:50 am
Location: In Your Mind...
Contact:

Post by Majoraslayer »

AKA Panama Jack wrote:
Majoraslayer wrote:Well, the main reason I'm concerned about where to put the code is a server side "Headers Already Sent" error. I know it won't affect the client side, other than in most cases the users would see the error at the top of the page.
You can use javascript to initiate a popup window anywhere in the body of the html page. You are not required to place javascript in the header.

Code: Select all

<script language="Javascript" type="text/javascript">
<!--
	window.open('/newprivatemessages.php', '_privatemsg', 'HEIGHT=225,resizable=yes,WIDTH=400');
//-->
</script>
The above will cause a 400 pixel wide, 225 pixel wide window to open and execute the newprivatemessages.php program through that window. The script can be placed anywhere in the main body of the html page and it will open a popup window.
That told me everything I needed to know, thanks. :D
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Beware of the mighty popup blocker :)
User avatar
AKA Panama Jack
Forum Regular
Posts: 878
Joined: Mon Nov 14, 2005 4:21 pm

Post by AKA Panama Jack »

If you want to bypass ANY popup blocker you make it a div layer on the html page with a close button. :) This way it's a popup no matter what type of popup blocker they use.
Last edited by AKA Panama Jack on Tue Nov 29, 2005 6:08 pm, edited 1 time in total.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

AKA Panama Jack wrote:If you want to buypass ANY popup blocker you make it a div layer on the html page with a close button. :) This way it's a popup no matter what type of popup blocker they use.
Very true... but Yuck :( I really hate those things. It'll be pretty difficult for ad-blockers to automatically stop them too I would think.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

You know how Mozilla blocks ads and notifies you? It makes this little bar come down from the top, notifying you that something happened, lets you close it too.

I'd love to see a JavaScript implementation of that. It'd be so nice and non-intrusive too...

By the way, d11wtq, check out AdBlock plus, which allows blocking of DIVs.
Majoraslayer
Forum Commoner
Posts: 64
Joined: Thu Jun 30, 2005 11:50 am
Location: In Your Mind...
Contact:

Post by Majoraslayer »

Ad-blockers aren't really an issue anyway. This is one of those rare cases where I'm the only one that has to be satisfied, because it goes in my new site administration panel I'm building. Thanks for the tips anyway :D
Post Reply