View Full Version : Go to URL instead of dialog box

04-23-2006, 06:11 PM

I am playing around with an alarm script, see:

var alarmTimer = null;
var alarmSet;
function setAlarm() { alarmSet = true; }
function clearAlarm() { alarmSet = false; }
function initAlarm() {
if (alarmTimer!=null)clearInterval(alarmTimer);
var nowTime = new Date();
document.exf1.h.value = nowTime.getHours();
document.exf1.m.value = nowTime.getMinutes();
document.exf1.s.value = nowTime.getSeconds();
function matchH() { return (document.exf1.ch.value == document.exf1.h.value); }
function matchM() { return (document.exf1.cm.value == document.exf1.m.value); }
function matchS() { return (document.exf1.cs.value == document.exf1.s.value); }
function countTime() {
var nowTime = new Date();
document.exf1.ch.value = nowTime.getHours();
document.exf1.cm.value = nowTime.getMinutes();
document.exf1.cs.value = nowTime.getSeconds();
if (matchH() && matchM() && matchS()) {

But I would rather a pop-up window (HTML) appear than a dialog box, is this possible?

04-23-2006, 06:13 PM
Of course. Replace:
window.open("popuppage.html");However, some popup blockers may stop this. Just a warning.

04-23-2006, 06:22 PM
Definitely not much of a challenge for you, Twey!

Thank you!

04-23-2006, 08:12 PM
Here's a question I've never gotten around to asking.

Popup blockers block anything that is automatically generated.

However, some don't block popups when you click on a link.

Why is this, and could it relate to the above situation?

Do the popup blockers check if the user DID something to make it happen?

Or... what?

04-23-2006, 09:10 PM
Do the popup blockers check if the user DID something to make it happen?Exactly right.
Most good popup blockers will, on encountering a window.open() call, go up through the stack trace until they hit user input which is unfakeable by Javascript: the native code that calls the onclick() or onsubmit() functions, for example. If they leave the webpage code and get to a certain point up the native stack trace (browser dependent), they will know that it hasn't been fired by deliberate user input, and block the call.

04-23-2006, 09:14 PM
I am having trouble defining the size of the window (don't want it to be fullscreen, chromeless would be ideal).

window.open("page1.htm", "height=200,width=300");

doesn't work at all, any clue?

Any additional parameters I specify don't work at all.

04-23-2006, 09:21 PM
Before specifying the features of the window, you must give it a second parameter, which is its name.
window.open("page1.htm", "countdownwindow", "height=200,width=300");Real chromeless windows are impossible, though they can be faked with something like the DHTML Window script here on DD.