473,465 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

javascript:close() for tab in Firefox

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
Jun 27 '08 #1
13 5456
pe**********@gmail.com schreef:
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.

>
I can't tell what is running. It doesn't happen with IE.
IE sucks in its own way.
>
Any explanation/solution?

Ron Lowe
Regards,
Erwin Moller

Jun 27 '08 #2
SAM
pe**********@gmail.com a écrit :
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 ?
I have tried opener.focus() with no effect.
too late ?
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
Jun 27 '08 #3
Erwin Moller <Si******************************************@spam yourself.comwrites:
pe**********@gmail.com schreef:
>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/
Jun 27 '08 #4
Joost Diepenmaat schreef:
Erwin Moller <Si******************************************@spam yourself.comwrites:
>pe**********@gmail.com schreef:
>>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

Jun 27 '08 #5
Joost Diepenmaat wrote:
Erwin Moller <Si******************************************@spam yourself.comwrites:
>pe**********@gmail.com schreef:
>>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
Jun 27 '08 #6
Erwin Moller wrote on 14 mei 2008 in comp.lang.javascript:
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)
Jun 27 '08 #7
Erwin Moller <Si******************************************@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 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/
Jun 27 '08 #8
Joost Diepenmaat <jo***@zeekat.nlwrites:
Erwin Moller <Si******************************************@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...
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/
Jun 27 '08 #9
Joost Diepenmaat wrote:
Joost Diepenmaat <jo***@zeekat.nlwrites:
>Erwin Moller <Si******************************************@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.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Jun 27 '08 #10
Thomas 'PointedEars' Lahn <Po*********@web.dewrites:
Joost Diepenmaat wrote:
>Joost Diepenmaat <jo***@zeekat.nlwrites:
>>Erwin Moller <Si******************************************@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/
Jun 27 '08 #11
Joost Diepenmaat wrote:
Thomas 'PointedEars' Lahn <Po*********@web.dewrites:
>Joost Diepenmaat wrote:
>>Joost Diepenmaat <jo***@zeekat.nlwrites:
Erwin Moller <Si******************************************@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, <f8*******************@news.demon.co.uk>
Jun 27 '08 #12
Thomas 'PointedEars' Lahn <Po*********@web.dewrites:
>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/
Jun 27 '08 #13
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

Jun 27 '08 #14

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

Similar topics

4
by: Dave Blair | last post by:
Hi, I have a problem with our intranet, we are planning to install Firefox instead of Internet Explorer onto some new PCs. However, we can't get the following JavaScript to work in Firefox and...
4
by: nec | last post by:
Hi, I'm having trouble calling a function thats located in a iFrame from the parent. Shortly, i can't figure out the location in DOM. In IE it works fine with a simple line of...
4
by: Colin Graham | last post by:
Hi guys, Just a quickie here that i hope someone can help me with. Basically i want stop the user from closing the popup window using the small x button in the top right hand corner. Im aware...
10
by: andreister | last post by:
He there! I've discovered that the ================================================= document.links('link_id_here').href = "something"; ================================================= is...
0
by: Ashok | last post by:
I have developed a custom IE application in C# using webbrowser control. But i am facing couple of issues when user clicks on an Exit link on a page the application is getting grayed out, but not...
1
by: luckyroom505 | last post by:
Hello to you all. I am trying to use an already installed dll on a Windows machine. I use javascript, and the OBJECT tag. On Internet Explorer this works fine, but on Firefox (v1.04) not. ...
3
by: adbo_atoz | last post by:
Hello All I am trying to duplicate this code which works in IE to work in Firefox <SCRIPT LANGUAGE="javascript"> function submitOnEnterKey() { if(event.keyCode == 13) { event.returnValue...
1
by: Yeezy | last post by:
Hi, I have the following javascript in my .aspx page where it will redirect you to another new .apsx. However, I have no problem with it when running on IE.. But when it's run with firefox, the...
5
by: loveshack | last post by:
Can anyone help me please (i am quite a novice, but having fun learning). Im not sure if this is an ASP problem, a javascript problem or a browser problem. Firstly, everything i have written...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.