problem with popups.

C

Colin MacIntyre

Hi, I tried to follow the tutorial on htmlsource.com, but even if I copy and
paste it, I still can't get a window to popup. Is there something wrong with
this code?


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="CONTENT-TYPE" content="text/html;
charset=windows-1252">
<title>
Music
</title>
<link rel="STYLESHEET" href="virtue.css" type="text/css">

</head>
<body>

<script type="text/javascript">
<!--
var newwindow;
function poptastic(url)
{
newwindow=PrivoxyWindowOpen(url,'name','height=400,width=300');
if (window.focus) {newwindow.focus()}
}
// -->
</script>

<p>
Would you like to see <a
href="javascript:poptastic('/chords.html');">
chords</a> or lyrics?
</p>

</body>
</html>
 
M

McKirahan

Colin MacIntyre said:
Hi, I tried to follow the tutorial on htmlsource.com, but even if I copy and
paste it, I still can't get a window to popup. Is there something wrong with
this code?


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="CONTENT-TYPE" content="text/html;
charset=windows-1252">
<title>
Music
</title>
<link rel="STYLESHEET" href="virtue.css" type="text/css">

</head>
<body>

<script type="text/javascript">
<!--
var newwindow;
function poptastic(url)
{
newwindow=PrivoxyWindowOpen(url,'name','height=400,width=300');
if (window.focus) {newwindow.focus()}
}
// -->
</script>

<p>
Would you like to see <a
href="javascript:poptastic('/chords.html');">
chords</a> or lyrics?
</p>

</body>
</html>

Is '/chords.html' in the root of the Web server invoking it?

If not then use a fully qualified URL.
 
R

RobG

Colin said:
Hi, I tried to follow the tutorial on htmlsource.com, but even if I copy and
paste it, I still can't get a window to popup. Is there something wrong with
this code?

Do you get an error message? If so, what is it? Is it something like
"PrivoxyWindowOpen is note defined"?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="CONTENT-TYPE" content="text/html;
charset=windows-1252">
<title>
Music
</title>
<link rel="STYLESHEET" href="virtue.css" type="text/css">

</head>
<body>

<script type="text/javascript">
<!--

Don't use HTML comment delimiters inside script elements, they serve no
useful purpose and are potentially harmful.

var newwindow;
function poptastic(url)
{
newwindow=PrivoxyWindowOpen(url,'name','height=400,width=300');

What does PrivoxyWindowOpen() do? Where is it defined?

if (window.focus) {newwindow.focus()}
}
// -->
</script>

<p>
Would you like to see <a
href="javascript:poptastic('/chords.html');">
chords</a> or lyrics?

Using the javascript pseudo-protocol in the href attribute of an A element
is known to have unusual side-effects in some browsers. It also means that
users without script see a 'link' that does nothing. Instead, put a real
URL in the href and use an onclick attribute to open the popup.


<p>Would you like to see <a
href="/chords.html"
onclick="poptastic('/chords.html');return false;">chords</a>
or lyrics?</p>


Adding return false to the onclick means that if scripting is enabled, the
link won't be followed. Some popup blockers may still stop your script
from opening a popup however.


[...]
 
M

mouseit101

That meta tag from Dreamweaver I think, has caused problems with me,
try deleting it.
 
R

Randy Webb

(e-mail address removed) said the following on 1/14/2006 8:34 PM:
That meta tag from Dreamweaver I think

This one that you didn't bother quoting?

<meta http-equiv="CONTENT-TYPE" content="text/html;
charset=windows-1252">

That is *not* a "DreamWhacker" meta tag. It is a very standard version
of a meta tag in fact.
has caused problems with me, try deleting it.

Such as?
 
R

Richard Cornford

RobG said:
Do you get an error message? If so, what is it? Is it
something like "PrivoxyWindowOpen is note defined"?

What does PrivoxyWindowOpen() do? Where is it defined?

The name "PrivoxyWindowOpen" brings to mind a content
inserting/re-writing proxy of the 'Internet Security'/Add blocking type.
These often work by replacing the character sequence "window.open" with
a reference to an alternative 'window opening' (or, not opening)
function that it has previously inserted into the page. Obviously these
proxies need to work quickly and so probably do not restrict their
actions to contexts within the original source where javascript can be
expected to be found. Rather; replacing any sequences of characters that
correspond with the offending sequence wherever they are found in a
page.

If the OP is using (knowingly or otherwise) such a proxy while
attempting to view examples of javascript code (from tutorial and the
like) then original sequences of characters that correspond with
sequences that the proxy is set-up to filter will also be replaced. So,
while the original code may say 'window.open' (as would be expected in
the example shown) the OP may only be in a position to view it in its
modified state.

There is a certain irony in attempting to learn how to use javascript to
open new windows while operating the sort of software that contributes
to rendering the practice non-viable.
<snip>

I am surprised you didn't also find fault with that particularly
irrational construct. ;)

Richard.
 
C

Colin MacIntyre

Boy did I laugh when I read this! You're absolutely right, Privoxy (an IP
anonymizer and load/exit popup blocker) was automatically replacing the
code. Still, while using it, I can go to cnews.canoe.ca, or any other site
that offers a popup and it works fine. But try to do the same myself?
Nothing. Absolutely nothing. I exit Privoxy, replace the code with
window.open, still nothing. I try the 'onclick' suggestion, delete the
comment delimiters, nothing. /chords.html is in the same folder I'm testing
the page from. I also tried putting '/html/chords.html' thinking it might be
seeing the disk root as the root.

Testing with Firefox and IE by the way. IE does give a page error saying,
Line 1 Char 1 Error: Object expected Code: 0. Not sure what this means.

Thanks for the suggestions so far, I'm just pounding my head against the
desk over this one.
 
R

Randy Webb

(e-mail address removed) said the following on 1/15/2006 1:40 PM:
It just didnt work...... it completely failed,m also how do you quote
text?

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.

That is a ready-made answer I have for Google users that explains how to
quote text using groups.google.com to post.
 
R

RobG

Colin said:
Boy did I laugh when I read this! You're absolutely right, Privoxy (an IP
anonymizer and load/exit popup blocker) was automatically replacing the
code. Still, while using it, I can go to cnews.canoe.ca, or any other site
that offers a popup and it works fine. But try to do the same myself?
Nothing. Absolutely nothing. I exit Privoxy, replace the code with
window.open, still nothing. I try the 'onclick' suggestion, delete the
comment delimiters, nothing. /chords.html is in the same folder I'm testing
the page from.

The path /chords.html is, depending on the context, either the root of
your disk drive (roughly equivalent to c: in Windows) or the root of
your web domain. It is almost never the current folder.

Either remove the '/', add a leading dot './' to get the current
directory (i.e. use './chords.html') or use a full path including the
protocol. e.g. for a local file on Windows you might have:

file:///C:/Documents%20and%20Settings/yourUserID/webstuff/chords.html


The most common approach is to either remove the slash '/'.

I also tried putting '/html/chords.html' thinking it might be
seeing the disk root as the root.

That may work if chords.html is in a folder called 'html' which is at
the root of the same disk volume.

Testing with Firefox and IE by the way. IE does give a page error saying,
Line 1 Char 1 Error: Object expected Code: 0. Not sure what this means.

IE error messages are usually vague and often misleading, use the
Firefox JavaScript console - what does it report? It's not perfect, but
generally more helpful than IE.

[...]
 

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,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top