473,493 Members | 4,319 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

problem with popups.

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>
Jan 14 '06 #1
10 1928
"Colin MacIntyre" <co***@clanmacintyre.ca> wrote in message
news:43***********************@taz.nntpserver.com. ..
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.
Jan 14 '06 #2
Colin MacIntyre wrote:
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.
[...]

--
Rob
Jan 15 '06 #3
That meta tag from Dreamweaver I think, has caused problems with me,
try deleting it.

Jan 15 '06 #4
mo********@gmail.com 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?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 15 '06 #5
On 2006-01-14, Colin MacIntyre <co***@clanmacintyre.ca> wrote:
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?

newwindow=PrivoxyWindowOpen(url,'name','height=400 ,width=300');


you need to paste the code for PrivoxyWindowOpen also.

if you want it to work in more browsers give the <a> a taget that
matches 'name' above.

Bye.
Jasen
Jan 15 '06 #6
RobG wrote:
Colin MacIntyre wrote:
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"?

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


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.
if (window.focus) {newwindow.focus()}

<snip>

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

Richard.
Jan 15 '06 #7
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.
Jan 15 '06 #8
It just didnt work...... it completely failed,m also how do you quote
text?

Jan 15 '06 #9
mo********@gmail.com 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.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 15 '06 #10
Colin MacIntyre wrote:
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.

[...]

--
Rob
Jan 15 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2848
by: Art | last post by:
NEWBIE ALERT! Esteemed List Participants and Lurkers: (System: P-II 350, 192 meg, Win98 SE, Python 2.2.3, wxPythonWIN32-2.4.1.2-Py22.exe) I'm having a lot of fun getting started with Python...
52
4367
by: Harlan Messinger | last post by:
Can you help me figure out what to do about popups? Sometimes we develop web applications where popups make very good sense for precisely the same reasons they make sense in traditional...
3
1631
by: PSERVE | last post by:
Is the a way of preventing popups from other sites while your page is loading? -- Regards Nik http://www.itconsultancy.org
0
884
by: Fuv | last post by:
My problem is about web applications (ASP .net) developped in C# that are used with an IIS Server (v. 5.1 and 6.0 tested) . I'm using a web application that opens other web applications with a...
4
1510
by: ciprian.dosoftei | last post by:
Hello, I just finished a tutorial website regarding the development of DHTML popups. The site features several examples with downloadable samples. It also feature more complex effects like...
7
1735
by: Nik | last post by:
I'm trying to combine css-popups with an images-in-inline-lists gallery. The problem I see with http://www.niksally.f2s.com/upload/gallery/gallery.html is that the images jog when the mouse...
16
2296
by: Eric | last post by:
I have a user of a web application written in Java/JSP that is unable to login to the site simply because certain links on the page do not run when they are clicked. Other popups using Javascript...
1
1623
by: YotamElal | last post by:
Hello, I have a popup problem. When a popup is opened, I want all other popups to close immediatly. (except for its self and it's child popups) Here is my code: code: <!DOCTYPE HTML PUBLIC...
2
1061
by: smcardle | last post by:
Hi All, I developed a web page for a client that uses pure CSS popups for images and "more info" sections. The front page looks correct and renders properly in IE6, OPERA, FIREFOX and SAFARI. ...
0
891
by: LaMpiR | last post by:
I am working on website which i need to edit. Problem is that i am newbie at all this. I worked with php but asp.net is something totally strange for me. I have a problem. I need in datagrid text...
0
7118
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6980
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7192
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6862
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5452
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1397
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
282
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.