Connecting Tech Pros Worldwide Forums | Help | Site Map

javascript:close() for tab in Firefox

petcancervet@gmail.com
Guest
 
Posts: n/a
#1: Jun 27 '08
I am writing a PHP/MySQL web-page based system on Firefox and wish to
run a separate page from an <Alink to run a separate PHP script,
then close that page. Firefox starts a new tab for this and it closes
OK but I am then left with an egg-timer at the mouse arrow when over
top or bottom toolbars areas of the parent page.

I am using <BODY onLoad='javascript:close()'to fire the tab closure.
I have tried opener.focus() with no effect.

I can't tell what is running. It doesn't happen with IE.

Any explanation/solution?

Ron Lowe

Erwin Moller
Guest
 
Posts: n/a
#2: Jun 27 '08

re: javascript:close() for tab in Firefox


petcancervet@gmail.com schreef:
Quote:
I am writing a PHP/MySQL web-page based system on Firefox and wish to
run a separate page from an <Alink to run a separate PHP script,
then close that page. Firefox starts a new tab for this and it closes
OK but I am then left with an egg-timer at the mouse arrow when over
top or bottom toolbars areas of the parent page.
>
I am using <BODY onLoad='javascript:close()'to fire the tab closure.
I have tried opener.focus() with no effect.
That is no valid eventhandler.
It is pseudoprotocol for <a href="javascript:...">
Never use it.

To get your onload handler working simply use:
<body onLoad="someFunction();">

and define someFunction() elsewhere.
You can also put the direct javascript commands into the onLoad handler.

Quote:
>
I can't tell what is running. It doesn't happen with IE.
IE sucks in its own way.
Quote:
>
Any explanation/solution?
>
Ron Lowe
Regards,
Erwin Moller

SAM
Guest
 
Posts: n/a
#3: Jun 27 '08

re: javascript:close() for tab in Firefox


petcancervet@gmail.com a écrit :
Quote:
I am writing a PHP/MySQL web-page based system on Firefox and wish to
run a separate page from an <Alink to run a separate PHP script,
then close that page. Firefox starts a new tab for this and it closes
OK but I am then left with an egg-timer at the mouse arrow when over
top or bottom toolbars areas of the parent page.
>
I am using <BODY onLoad='javascript:close()'to fire the tab closure.
<body onload="self.close();">

What is the interest to load a page if it is to close it immediately ?

<body onload="setTimeout(self.close,200);">

Usually when the pop-up-tab is closed you come back to the opener tab.
There is no reason to get egg-timer nor wheel

What does the error console of Fx say ?
Quote:
I have tried opener.focus() with no effect.
too late ?
Quote:
Any explanation/solution?
what is supposed the "separate" php to do ?
can't it close the window (tab) itself ?
(instead of onload in body tag)


in opener try with your link :

<a href="page.php" target="other" onmouseup="this.blur();">


<a href="page.php"
onclick="window.open(this.href);this.blur();return false;">
and don't forget ..............................^^^^^^^^^^^^^

--
sm
Joost Diepenmaat
Guest
 
Posts: n/a
#4: Jun 27 '08

re: javascript:close() for tab in Firefox


Erwin Moller <Since_humans_read_this_I_am_spammed_too_much@spam yourself.comwrites:
Quote:
petcancervet@gmail.com schreef:
Quote:
>I am writing a PHP/MySQL web-page based system on Firefox and wish to
>run a separate page from an <Alink to run a separate PHP script,
>then close that page. Firefox starts a new tab for this and it closes
>OK but I am then left with an egg-timer at the mouse arrow when over
>top or bottom toolbars areas of the parent page.
>>
>I am using <BODY onLoad='javascript:close()'to fire the tab closure.
>I have tried opener.focus() with no effect.
>
That is no valid eventhandler.
yes it is. in this case, javascript: is interpreted as a label. it's
just useless.


--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Erwin Moller
Guest
 
Posts: n/a
#5: Jun 27 '08

re: javascript:close() for tab in Firefox


Joost Diepenmaat schreef:
Quote:
Erwin Moller <Since_humans_read_this_I_am_spammed_too_much@spam yourself.comwrites:
>
Quote:
>petcancervet@gmail.com schreef:
Quote:
>>I am writing a PHP/MySQL web-page based system on Firefox and wish to
>>run a separate page from an <Alink to run a separate PHP script,
>>then close that page. Firefox starts a new tab for this and it closes
>>OK but I am then left with an egg-timer at the mouse arrow when over
>>top or bottom toolbars areas of the parent page.
>>>
>>I am using <BODY onLoad='javascript:close()'to fire the tab closure.
>>I have tried opener.focus() with no effect.
>That is no valid eventhandler.
>
yes it is. in this case, javascript: is interpreted as a label. it's
just useless.
>
Hi,

OK, thanks for correcting that. I didn't know that.

Is there ANY use ever for javascript: ??
(I don't want to advise people to avoid it if it has actual use
somewhere/somehow.)

Regards,
Erwin Moller

Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
#6: Jun 27 '08

re: javascript:close() for tab in Firefox


Joost Diepenmaat wrote:
Quote:
Erwin Moller <Since_humans_read_this_I_am_spammed_too_much@spam yourself.comwrites:
Quote:
>petcancervet@gmail.com schreef:
Quote:
>>I am writing a PHP/MySQL web-page based system on Firefox and wish to
>>run a separate page from an <Alink to run a separate PHP script,
>>then close that page. Firefox starts a new tab for this and it closes
>>OK but I am then left with an egg-timer at the mouse arrow when over
>>top or bottom toolbars areas of the parent page.
>>>
>>I am using <BODY onLoad='javascript:close()'to fire the tab closure.
>>I have tried opener.focus() with no effect.
>That is no valid eventhandler.
>
yes it is. in this case, javascript: is interpreted as a label. it's
just useless.
To be precise, it is not an event handler, valid or otherwise. It is the
value of an intrinsic *event handler attribute*. The value, which type is
CDATA, is supposed to be a string value representing code written in an
ECMAScript implementation here (because such a language appears to be the
default scripting language in past and current HTML UAs).

Whether `javascript:' constitutes syntactically valid ECMAScript-compliant
code depends on the implementation used: ECMAScript before Edition 3 did not
specify the LabelStatement production. So strictly speaking, it is e.g. not
valid (by any standards you want to apply) in Netscape before version 4.0,
and Microsoft Internet Explorer before version 4.0, because the ECMAScript
implementations they supported did not support that particular feature yet.

http://PointedEars.de/scripts/es-matrix/#javascript


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Evertjan.
Guest
 
Posts: n/a
#7: Jun 27 '08

re: javascript:close() for tab in Firefox


Erwin Moller wrote on 14 mei 2008 in comp.lang.javascript:
Quote:
Is there ANY use ever for javascript: ??
(I don't want to advise people to avoid it if it has actual use
somewhere/somehow.)
>
Yes.

1 In favelets/bookmarklets.

2 In an [IE only] vbscript using page, to call sporadic js:

========================
<script type='text/vbscript'>
document.write "Hello<br>"
i = 7
</script>

<div onclick = 'javascript:alert(++i);'>
Click me!
</div>
========================

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Joost Diepenmaat
Guest
 
Posts: n/a
#8: Jun 27 '08

re: javascript:close() for tab in Firefox


Erwin Moller <Since_humans_read_this_I_am_spammed_too_much@spam yourself.comwrites:
Quote:
Is there ANY use ever for javascript: ??
(I don't want to advise people to avoid it if it has actual use
somewhere/somehow.)
IIRC the purpose of the javascript: URLs (and URLs only) is to call a
JS function that returns the content of a page/image/whatever. IOW you
could use it to generate an image or page on the fly. Which won't work
for event handlers, since event attribute values aren't URLs.

For instance: <a href="javascript:'bla'">click</a>

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Joost Diepenmaat
Guest
 
Posts: n/a
#9: Jun 27 '08

re: javascript:close() for tab in Firefox


Joost Diepenmaat <joost@zeekat.nlwrites:
Quote:
Erwin Moller <Since_humans_read_this_I_am_spammed_too_much@spam yourself.comwrites:
>
Quote:
>Is there ANY use ever for javascript: ??
>(I don't want to advise people to avoid it if it has actual use
>somewhere/somehow.)
>
IIRC the purpose of the javascript: URLs (and URLs only) is to call a
JS function
^^^^^^^^ or direct code. it seems to work more or less like eval()
in that regard...
Quote:
that returns the content of a page/image/whatever. IOW you
could use it to generate an image or page on the fly. Which won't work
for event handlers, since event attribute values aren't URLs.
>
For instance: <a href="javascript:'bla'">click</a>
--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
#10: Jun 27 '08

re: javascript:close() for tab in Firefox


Joost Diepenmaat wrote:
Quote:
Joost Diepenmaat <joost@zeekat.nlwrites:
Quote:
>Erwin Moller <Since_humans_read_this_I_am_spammed_too_much@spam yourself.comwrites:
Quote:
>>Is there ANY use ever for javascript: ??
>>(I don't want to advise people to avoid it if it has actual use
>>somewhere/somehow.)
>IIRC the purpose of the javascript: URLs (and URLs only) is to call a
>JS function
^^^^^^^^ or direct code. it seems to work more or less like eval()
in that regard...
It is described how it is supposed to work, and that appears to match the
implementations' behavior. I have posted the description in another thread
*today*, so there really is no need to post your wild assumptions.


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Joost Diepenmaat
Guest
 
Posts: n/a
#11: Jun 27 '08

re: javascript:close() for tab in Firefox


Thomas 'PointedEars' Lahn <PointedEars@web.dewrites:
Quote:
Joost Diepenmaat wrote:
Quote:
>Joost Diepenmaat <joost@zeekat.nlwrites:
Quote:
>>Erwin Moller <Since_humans_read_this_I_am_spammed_too_much@spam yourself.comwrites:
>>>Is there ANY use ever for javascript: ??
>>>(I don't want to advise people to avoid it if it has actual use
>>>somewhere/somehow.)
>>IIRC the purpose of the javascript: URLs (and URLs only) is to call a
>>JS function
> ^^^^^^^^ or direct code. it seems to work more or less like eval()
>in that regard...
>
It is described how it is supposed to work, and that appears to match the
implementations' behavior. I have posted the description in another thread
*today*, so there really is no need to post your wild assumptions.
A link to a description to how it's "supposed to work" would be
nice. It's unsurprisingly hard to search for this behaviour because of
the keywords involved.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
#12: Jun 27 '08

re: javascript:close() for tab in Firefox


Joost Diepenmaat wrote:
Quote:
Thomas 'PointedEars' Lahn <PointedEars@web.dewrites:
Quote:
>Joost Diepenmaat wrote:
Quote:
>>Joost Diepenmaat <joost@zeekat.nlwrites:
>>>Erwin Moller <Since_humans_read_this_I_am_spammed_too_much@spam yourself.comwrites:
>>>>Is there ANY use ever for javascript: ??
>>>>(I don't want to advise people to avoid it if it has actual use
>>>>somewhere/somehow.)
>>>IIRC the purpose of the javascript: URLs (and URLs only) is to call a
>>>JS function
>> ^^^^^^^^ or direct code. it seems to work more or less like eval()
>>in that regard...
>It is described how it is supposed to work, and that appears to match the
>implementations' behavior. I have posted the description in another thread
>*today*, so there really is no need to post your wild assumptions.
>
A link to a description to how it's "supposed to work" would be
nice. It's unsurprisingly hard to search for this behaviour because of
the keywords involved.
It isn't.

http://groups.google.com/groups?as_q...5&as_maxy=2008

(Well, I have been off by 7 minutes ...)


PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk>
Joost Diepenmaat
Guest
 
Posts: n/a
#13: Jun 27 '08

re: javascript:close() for tab in Firefox


Thomas 'PointedEars' Lahn <PointedEars@web.dewrites:
Quote:
Quote:
>A link to a description to how it's "supposed to work" would be
>nice. It's unsurprisingly hard to search for this behaviour because of
>the keywords involved.
>
It isn't.
>
<http://groups.google.com/groups?as_q...num=10&scoring
=r&as_epq=&as_oq=&as_eq=&as_ugroup=comp.lang.javas cript&as_usubject=&
as_uauthors=PointedEars&lr=&as_qdr=&as_drrb=b&as_m ind=13&as_minm=5&
as_miny=2008&as_maxd=14&as_maxm=5&as_maxy=2008>

Neither of the two pages you mention in that post is in the first 100
results on a google search of '"javascript url"' (with quotes) or
'javascript url' (without quotes) for me. And not to be annoying, but
it looks to me like those pages are describing browser behaviour as it
was whenever they were written instead of any kind of standard (not
that there's anything wrong with that).

Anyway, thanks.

Joost.


--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
petcancervet@gmail.com
Guest
 
Posts: n/a
#14: Jun 27 '08

re: javascript:close() for tab in Firefox


Thanks, guys (& gals but I didn't notice any)

That got rather esoteric.

Just to be annoying I have rewritten the code using IFRAME instead!
The point with the PHP is that I have to fire code to set up a new
MySQL table but then return to the submitting page as it was.
Reloading PHP pages leads to very complicated if {}s and becomes
unintelligible.

Cheers

Ron

Closed Thread


Similar JavaScript / Ajax / DHTML bytes