Thomas 'PointedEars' Lahn rambled in where he
thinks he is in and therefore thinks he is
the man of all men when in reality he is a hypocritical embicile who
fails to practice what he preaches but in any event he incoherently
typed the following on his computer and posted the following on the
Twelth day of January in the Year 2006 of the Proleptic Gregorian
Calender at approximately 6 hours and 11 minutes past the hour of
midnight in the MET Time Zone according to the Header sent by his
NewsReader whereby I read it at approximately 1 hour and 51 minutes past
midnight in the Eastern Standard Time Zone in the United States of
America and promptly and replying to said post:
Now, stop whining about your damn attributions.
[...]
<script type="text/javascript">
Please provide attribution of quoted material. Usenet is not a (1:1)
chat, by default people all over the planet read what you write.
Only if "people all over the planet" read English, subscribe to Usenet
and to this particular Newsgroup but it's irrelevant as attribution
should be given.
Valid Reference to point out.
Irrelevant to your comments as it only explains how to quote, not to
attribute.
Therefore, it also does not make much sense to address only one specific
person in your postings (with rare exceptions).
Sure it does if you are replying to one person in particular and you can
not email them due to email restrictions placed on the email address
used by the person you are replying to.
What the hell that has to do with providing attribution, posting here,
or anything else other than your desire to post a URL to a Wiki eludes
me but to each his own.
It has to be the first argument of window.open(), so you should pass it for
the only argument of popitup(), as that is used there in the window.open()
call.
In the `onclick' attribute value of the `a' element, this is `this.href'
which refers to the `href' attribute value of that `a' element (to be
exact: the element that fired the event, which happens to be that `a'
element here).
Elements do not "fire" events, they "trigger" them.
So you should replace `URLToFile' with the URL of the resource you want
displayed in the popup or in the current window, if client-side JS is not
supported.
Absolutely and 100% agreed.
However, as I already pointed out, the above code is not sufficient.
Nowhere in either of your posts in this thread have you pointed out
anything about the "above code not being sufficient" (even though it is
insufficient).
A popup blocker may prevent opening a new window, yet the event is canceled
anyway (through `return false').
Very valid point. But there is another potential problem with popup
blockers that your code does not deal with.
And it will fail if the focus() method is not supported for Window objects.
Can you name a UA that supports window.open but not the focus() method
of that Window object?
Therefore, use the following instead:
Don't, without corrections as it has several flaws as well.
function isMethodType(s)
{
return (s == "function" || s == "object");
}
Un-needed Function and Global Variable introduced.
Syntax Error
Expected ';'
function popitup(url)
{
if (newwindow.location && !newwindow.closed)
Assuming the newwindow has and supports the closed property. Better
feature test for that Spock.
{
newwindow.location = url;
Assuming the newwindow supports setting the location property. Better
feature test for that Spock.
if (isMethodType(typeof newwindow.focus))
Here is the call to the unneeded Function. If all you want to do is find
out if the newwindow supports the focus, you simply test the typeof here
and no need to call a second function which will increase the overhead:
if ((typeof newwindow.focus) == 'function')
{
newwindow.focus();
}
}
else
{
newwindow =
window.open(url, 'myWindow', 'width=130,height=180,resizable');
And if a popup blocker redefines window.open to return true, your code
will fail miserably.
This is code that is inserted by Symantec (Norton):
var SymRealWinOpen = window.open;
function SymWinOpen(url, name, attributes)
{
return (new Object());
}
window.open = SymWinOpen;
}
return newwindow;
}
and in the HTML code:
<a href="URLToFile" onclick="return !popitup(this.href);"
Whereas `URLToFile' should be replaced as described.
Try this test page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"
http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
<head>
<title>Form Test Page</title>
<script type="text/javascript">
var SymRealWinOpen = window.open;
function SymWinOpen(url, name, attributes)
{
return (new Object());
}
window.open = SymWinOpen;
var newwindow = '';
function popitup(url){
if (newwindow.location && !newwindow.closed)
{
newwindow.location = url;
if ((typeof newwindow.focus) == 'function')
{newwindow.focus();}
}
else
{newwindow=window.open(url,'myWindow','width=130,height=180,resizable');}
return newwindow;
}
</script>
</head>
<body>
<p>
<a href="blank2.html" onclick="return !popitup(this.href);">
What's Your Vice?</a>
</body>
</html>
And you will get no new page, no new window.
To date the best popup script I have seen or used was written by Yann
and for the life of me can't find it in the Archives or I would post it.
It even dealt with Nortons code as well.
But in the end, the best approach is one that follows something along
the lines of Richard's page:
<URL:
http://www.litotes.demon.co.uk/js_info/pop_ups.html >