Two questions...

  • Thread starter The Natural Philosopher
  • Start date
T

The Natural Philosopher

1/. Can anyone tell me why renaming a function from 'update()' to
'form_update()' makes Safari work when it didn't before?


2/. I would LIKE if possible, to do the following.

User is filling in a BIG form. MYSQL/PHP generated. he finds that the
option he needs in a select statement isn't there, and needs to be added
via a different form.

I can easily spawn a new window to do this, but what I need to happen is

- new window opens in NEW WINDOW - not new tab..even if that's how the
browser is configured.

- on shutting down new window..yea even unto clicking on it's corner and
saying 'close' , the main program window can be forced to reload its
data, to pick up the changes.

I am very unsure of inter-window communications, and could use any
pointers...
 
E

Erwin Moller

The said:
1/. Can anyone tell me why renaming a function from 'update()' to
'form_update()' makes Safari work when it didn't before?

Hi,

First question: I have no clue.
Safari? I gave up on Safari and JavaScript a long time ago.
Maybe Apple upgraded it to a better browser lately?

2/. I would LIKE if possible, to do the following.

User is filling in a BIG form. MYSQL/PHP generated. he finds that the
option he needs in a select statement isn't there, and needs to be added
via a different form.
OK.


I can easily spawn a new window to do this, but what I need to happen is

- new window opens in NEW WINDOW - not new tab..even if that's how the
browser is configured.

As far as I know, the tabbed opening of a new window only happens when
you do not give dimensions.
If you do, it opens a real new window (not tabbed).

Could open in tab:
window.open("index.php","testing");

Will NOT open in tab:
window.open("index.php","testing","width=300,height=300");

- on shutting down new window..yea even unto clicking on it's corner and
saying 'close' , the main program window can be forced to reload its
data, to pick up the changes.

Have a look at the unOnload event handler.
You can write something like this:

in popup window:
<body onUnload="refreshDaddyPlease();">

<script type="text/javascript">
function refreshDaddyPlease(){
opener.location.reload(true);
}
</script>

The true in reload(true) means force reloads, even if the http-header
If-Modified_since says otherwise.

I am very unsure of inter-window communications, and could use any
pointers...

Well, basic inter-window communication is simple.
eg:
[from openerpage]
var myRefToNewWindow = window.open("index.php","testing");

Now you can use myRefToNewWindow whenever you want to address the new
window. You can also call its javascript functions, eg:
myRefToNewWindow.someFunction("testing");

From the popup window, simply use the keyword 'opener' to find the
window that did it.

Good luck!

Regards,
Erwin Moller
 
E

Erwin Moller

Erwin Moller wrote:
Have a look at the unOnload event handler.
You can write something like this:

Correction: The event handler is NOT called unOnload, but onUnload.
But you figured that yourself already probably.
;-)

Regards,
Erwin Moller
 
H

Henry

1/. Can anyone tell me why renaming a function from 'update()' to
'form_update()' makes Safari work when it didn't before?

Not without the context. The balance of probability is that you were
referring to the function from an event handler generated from an
intrinsic event attributer and the scope chain that the browser
generated for the event handling function it built from the attribute
value included an object with an - update - property above the global
object.
2/. I would LIKE if possible, to do the following.

User is filling in a BIG form. MYSQL/PHP generated. he finds that the
option he needs in a select statement isn't there, and needs to be added
via a different form.

I can easily spawn a new window to do this,

Not in the sense of expecting an attempt to open a new window to be
successful.
but what I need to happen is

- new window opens in NEW WINDOW - not new tab..

Too late. The new window/tab distinction is (where available)
exclusively under user control.
even if that's how the
browser is configured.

Hard luck.
- on shutting down new window..yea even unto clicking on it's
corner and saying 'close' , the main program window can be
forced to reload its data, to pick up the changes.

So that is two inevitable HTTP request/response pairs and two sets of
processing HTML into displayed forms. In which case why not have the
existing window show the new form and then return to the old form when
it is submitted (with the data from the old form stored in the user's
session on the server in the interim)?
I am very unsure of inter-window communications, and could use any
pointers...

Avoid it like the plague.
 
T

Thomas 'PointedEars' Lahn

Erwin said:
Will NOT open in tab:
window.open("index.php","testing","width=300,height=300");
Wrong.


Have a look at the unOnload event handler.

The _onunload_ intrinsic event handler attribute of the `body' element
will provide listener code for the `unload' event of that element, i.e.
when the document is unloaded. This will happen when the window is
closed *or* when the user navigates away.
You can write something like this:

in popup window:
<body onUnload="refreshDaddyPlease();">

<script type="text/javascript">
function refreshDaddyPlease(){
opener.location.reload(true);

`opener' is a property of Window objects and should be referred so:

window.opener

It should also be tested whether or not the opener is (still) available,
and whether or not that Window object provides a reload() method:

var o;
if (window.opener && !(o = window.opener).closed
&& /\b(function|object)\b/i.test(typeof o.reload)
&& o.reload)
{
o.reload(true);
}


PointedEars
 
E

Erwin Moller

Thomas said:

Hi Pointedears,

Wrong?
Care to explain that a little more?

Test the following stupid script, and see for yourself.


<html>
<head>
<title>test</title>
</head>
<body>

<span onClick="openawin();">maybe open in a tab</span>
<br>
<span onClick="openawin2();">prolly open in window</span>

<script type="text/javascript">
function openawin(){
window.open("whatever.html","testing");
}


function openawin2(){
window.open("whatever.html","testing2","width=300,height=300");
}

</script>

</body>
</html>


Works as advertised (by me) in ie7 and ff2.

Do I miss something?


`opener' is a property of Window objects and should be referred so:

window.opener

Correct. Sloppy me.

Erwin Moller
 
E

Erwin Moller

Thomas said:
Erwin said:
Thomas said:
Erwin Moller wrote:
Will NOT open in tab:
window.open("index.php","testing","width=300,height=300");
Wrong. [...]
Wrong?

Yes.

Care to explain that a little more?

It is wrong that the above call will necessarily not open a new tab.

Well, that clears it all up then.... NOT.
Did you care to test the samplescript?
Why don't you explain why you think it is wrong?
I did those tests on ff2 and ie7, you know, and I saw the results.

Don't get me wrong, I don't question your experience with javascript.
I know you know a lot, but your educational abilities leave somewhat to
be desired.


You might throw in a little more, like: "but it is not RFC xxy" or
"doesn't work like that in Safari/opera/Lynx".

Regards,
Erwin Moller
 
T

Thomas 'PointedEars' Lahn

Erwin said:
Thomas said:
Erwin said:
Thomas 'PointedEars' Lahn wrote:
Erwin Moller wrote:
Will NOT open in tab:
window.open("index.php","testing","width=300,height=300");
Wrong.
[...]
Wrong? Yes.

Care to explain that a little more?
It is wrong that the above call will necessarily not open a new tab.

Well, that clears it all up then.... NOT.
Did you care to test the samplescript?

No, I did not need to. I used very similar code more often than you can
imagine.
Why don't you explain why you think it is wrong?

Because the correct explanation was already given by another person in this
thread.
I did those tests on ff2 and ie7, you know, and I saw the results.

So? You have tested with a very small subset of Web browsers (you did not
even include a non-browser UA), and saw your assumption confirmed. Why
would that be confirming your assumption for the general case? Don't answer
-- it does not.
Don't get me wrong, I don't question your experience with javascript.
I know you know a lot, but your educational abilities leave somewhat to
be desired.

Since when is this a J(ava)Script school? Am I being paid to sacrifice
free/business time to teach someone?
You might throw in a little more, like: "but it is not RFC xxy" or
"doesn't work like that in Safari/opera/Lynx".

For example, it does not work with Firefox 2.0.0.6 when the Tab Mix Plus
extension is installed and appropriately configured.


PointedEars
 
E

Erwin Moller

Thomas said:
Erwin said:
Thomas said:
Erwin Moller wrote:
Thomas 'PointedEars' Lahn wrote:
Erwin Moller wrote:
Will NOT open in tab:
window.open("index.php","testing","width=300,height=300");
Wrong.
[...]
Wrong?
Yes.

Care to explain that a little more?
It is wrong that the above call will necessarily not open a new tab.
Well, that clears it all up then.... NOT.
Did you care to test the samplescript?

No, I did not need to. I used very similar code more often than you can
imagine.

I can imagine a lot more than you can imagine.
Because the correct explanation was already given by another person in this
thread.

???
By who? I read both Henry's and Lee's posts, and they didn't address my
suggestion.
So? You have tested with a very small subset of Web browsers (you did not
even include a non-browser UA), and saw your assumption confirmed. Why
would that be confirming your assumption for the general case? Don't answer
-- it does not.

I answer when I feel like.
In this case I have this distinct impression the OP was not coding for a
non-browser UA.
Philosopher needed a popup to add some stuff to a big form.
What makes you think he wants a popup window for a non-browser agent?
I think that is a farfetched remote possibility, and the OP would have
stated it if that was the case.

And IE & FF are a small subset of webbrowsers?
If you mean 'all existing browsers', yes, of course.
If you mean 'all currently used browsers', then you are wrong of course.

IE6 doesn't have tabbed browsing, so it is no issue there.
IE7 has tabbed browsing, and the approach I suggested works as I claimed
in IE7.
The same for FF2.

You make it sound like my suggestion makes no sense, and use an argument
that includes non-browser UA.
Really, I don't get it. :-/
Having a bad day Thomas?
Since when is this a J(ava)Script school? Am I being paid to sacrifice
free/business time to teach someone?

No, you are not being paid for writing in here, nor am I.
But since you care to drop in here every day I can remember, you surely
must have some affinity with javascript.
I wonder why you answer posts if you don't want to help.
Just saying 'wrong' isn't really helping anybody, you must know that...
Explaining why you think something is wrong, does help.
For example, it does not work with Firefox 2.0.0.6 when the Tab Mix Plus
extension is installed and appropriately configured.

Yes, sure.
I doesn't work on with any browser with an agressive 'properly
configured' popup blocker either.
Nor will it work on a browser that doesn't understand window.open().
etc. etc.

What is the point in thinking up farfetched situations were it will fail?

If you use document.getElementById() in your code, and I write an
extension that screws that all up, does that make your approach wrong?

The OP wants a solution that works, preferably in most situation.
And I still think my suggestion does that (on IE7 and FF2) and on
browsers without tabbed browsing it is not an issue.

PointedEars

Erwin Moller
 
T

Thomas 'PointedEars' Lahn

Erwin said:
Thomas said:
Erwin said:
Thomas 'PointedEars' Lahn wrote:
Erwin Moller wrote:
Thomas 'PointedEars' Lahn wrote:
Erwin Moller wrote:
Will NOT open in tab:
window.open("index.php","testing","width=300,height=300");
Wrong.
[...]
Wrong?
Yes.

Care to explain that a little more?
It is wrong that the above call will necessarily not open a new tab.
Well, that clears it all up then.... NOT.
Did you care to test the samplescript?
No, I did not need to. I used very similar code more often than you can
imagine.

I can imagine a lot more than you can imagine.

I can't imagine that.
???
By who? I read both Henry's and Lee's posts, and they didn't address my
suggestion.

Henry did post

| > but what I need to happen is
| >
| > - new window opens in NEW WINDOW - not new tab..
|
| Too late. The new window/tab distinction is (where available)
| exclusively under user control.
I answer when I feel like.
In this case I have this distinct impression the OP was not coding for a
non-browser UA.

Doesn't matter.
Philosopher needed a popup to add some stuff to a big form.
What makes you think he wants a popup window for a non-browser agent?

I did not state that I do. You miss the point entirely.
I think that is a farfetched remote possibility,

Given his amount of input on the subject so far, it is as far-fetched as the
opposite case.
and the OP would have stated it if that was the case.

Non sequitur.
And IE & FF are a small subset of webbrowsers?

Yes, they are. Two out of a dozen, at the minimum.
If you mean 'all existing browsers', yes, of course.
If you mean 'all currently used browsers', then you are wrong of course.

Not at all. Just because you are apparently not familiar with other
browsers does not mean they are not used.
[...]
You make it sound like my suggestion makes no sense, and use an argument
that includes non-browser UA.
Really, I don't get it. :-/

You misunderstand. That there are non-browser UAs is just another reason
why you are wrong.
Having a bad day Thomas?

That, too.
No, you are not being paid for writing in here, nor am I.
But since you care to drop in here every day I can remember, you surely
must have some affinity with javascript.
I wonder why you answer posts if you don't want to help.

Sometimes I just have the strangest idea that people will actually do some
research themselves before they post.
[...]
For example, it does not work with Firefox 2.0.0.6 when the Tab Mix Plus
extension is installed and appropriately configured.

Yes, sure.
I doesn't work on with any browser with an agressive 'properly
configured' popup blocker either.
Nor will it work on a browser that doesn't understand window.open().
etc. etc.

What is the point in thinking up farfetched situations were it will fail?

Tab Mix Plus being one of the most recommended and therefore most used
extensions for Firefox 2 since Tabbrowser Extensions went incompatible
with that, that is hardly a far-fetched situation. Nor is users simply
persisting on not having other windows opened but the one that they
opened themselves.
If you use document.getElementById() in your code, and I write an
extension that screws that all up, does that make your approach wrong?

Comparing apples with oranges does not help your argument to start walking.
The OP wants a solution that works, preferably in most situation.

Yours does not, for several valid reasons. You can either live with that or
stomp your foot, telling everyone you are right anyway without being able to
back that up (not that you really tried, but the proof is doomed to fail),
and drown in the quicksand you are standing on eventually, along with all
the people that followed your advice.


PointedEars
 
B

Bart Van der Donck

Thomas said:
Non sequitur.

Some common sense would suit you.
Yes, they are. Two out of a dozen, at the minimum.

No, they are not. MSIE/FF are the De Facto browsers.

MSIE & FF are a subset = right.
MSIE & FF are a small subset = wrong.
Comparing apples with oranges does not help your argument to start walking.

I find this a very good argument.
Yours does not, for several valid reasons.

I don't agree. You can safely state that Erwin's solution works in
most situations. This is a typical PointedEars-discussion, focussing
only on extremely unlikely, negligible conditions.

--
Bart

"All staff must leave the building by the appointed fire exits in an
orderly manner, unless instructed otherwise." (Emergeny Drill
Instructions, London)
 
T

The Natural Philosopher

Erwin said:
The said:
1/. Can anyone tell me why renaming a function from 'update()' to
'form_update()' makes Safari work when it didn't before?

Hi,

First question: I have no clue.
Safari? I gave up on Safari and JavaScript a long time ago.
Maybe Apple upgraded it to a better browser lately?

2/. I would LIKE if possible, to do the following.

User is filling in a BIG form. MYSQL/PHP generated. he finds that the
option he needs in a select statement isn't there, and needs to be
added via a different form.
OK.


I can easily spawn a new window to do this, but what I need to happen is

- new window opens in NEW WINDOW - not new tab..even if that's how the
browser is configured.

As far as I know, the tabbed opening of a new window only happens when
you do not give dimensions.
If you do, it opens a real new window (not tabbed).

Could open in tab:
window.open("index.php","testing");

Will NOT open in tab:
window.open("index.php","testing","width=300,height=300");

- on shutting down new window..yea even unto clicking on it's corner
and saying 'close' , the main program window can be forced to reload
its data, to pick up the changes.

Have a look at the unOnload event handler.
You can write something like this:

in popup window:
<body onUnload="refreshDaddyPlease();">

<script type="text/javascript">
function refreshDaddyPlease(){
opener.location.reload(true);
}
</script>

The true in reload(true) means force reloads, even if the http-header
If-Modified_since says otherwise.

I am very unsure of inter-window communications, and could use any
pointers...

Well, basic inter-window communication is simple.
eg:
[from openerpage]
var myRefToNewWindow = window.open("index.php","testing");

Now you can use myRefToNewWindow whenever you want to address the new
window. You can also call its javascript functions, eg:
myRefToNewWindow.someFunction("testing");

From the popup window, simply use the keyword 'opener' to find the
window that did it.

Good luck!

Regards,
Erwin Moller
Thanks Erwin.
That's the key phrases I needed.. I can 'keeep buggering on' and make
that lot work fine.
 
T

The Natural Philosopher

Erwin said:
Thomas 'PointedEars' Lahn wrote:

I answer when I feel like.
In this case I have this distinct impression the OP was not coding for a
non-browser UA.
Philosopher needed a popup to add some stuff to a big form.
What makes you think he wants a popup window for a non-browser agent?
I think that is a farfetched remote possibility, and the OP would have
stated it if that was the case.

Indeed. It isn't even for public consumption really. Its for an internal
database. No that MIGHT get sold on to other users, but in the same way
we used to say 'only works on Wyse50's, sorry VT100's are not enough' if
I can get it working against IE6, IE7, FF2, and Safari, its enough for me.

Its not a disaster if it opens in a tab..just another thing for the user
to have to do. I wanted it to pop up as an overlay, get filled in,
submitted, and at that point the main screen refreshes.

I was looking for practical solutions, and Erwins response is practical.

It may not be ture for all time but it looks like it works.
And IE & FF are a small subset of webbrowsers?

Yeah, about 85% of what runs on a typical office machine, and with IE6,
about 90%, and safari runs on the macs. Thts around 95%.

Anyone trying to use this code from a mobile phone can...do the other
thing. It hasn't a chance on much less than a 1024x768 screen for a start..
If you mean 'all existing browsers', yes, of course.
If you mean 'all currently used browsers', then you are wrong of course.

IE6 doesn't have tabbed browsing, so it is no issue there.
IE7 has tabbed browsing, and the approach I suggested works as I claimed
in IE7.
The same for FF2.

You make it sound like my suggestion makes no sense, and use an argument
that includes non-browser UA.
Really, I don't get it. :-/
Having a bad day Thomas?


No, you are not being paid for writing in here, nor am I.
But since you care to drop in here every day I can remember, you surely
must have some affinity with javascript.
I wonder why you answer posts if you don't want to help.
Just saying 'wrong' isn't really helping anybody, you must know that...
Explaining why you think something is wrong, does help.


Yes, sure.
I doesn't work on with any browser with an agressive 'properly
configured' popup blocker either.
Nor will it work on a browser that doesn't understand window.open().
etc. etc.

What is the point in thinking up farfetched situations were it will fail?

If you use document.getElementById() in your code, and I write an
extension that screws that all up, does that make your approach wrong?

The OP wants a solution that works, preferably in most situation.
And I still think my suggestion does that (on IE7 and FF2) and on
browsers without tabbed browsing it is not an issue.

Precisely.
I gave teh environm,ent and background because I wantd to sidestp al the
usual pedantry about

'what about browsers that have script turned off'

WE tell the users to turn them on.

'What about browsers for people who use 'braille'?'

Sorry, we don't employ blind people to run laser cutters.

In other words, the users will run what we tell them, its just in the
area of firefox tabbing that I wanted to somehow force a popup rather
than a new tab. Its easy enough to drop popup blocking for sites that
begin with 192.168..after all ;-)
 
T

The Natural Philosopher

Bart said:
Some common sense would suit you.


No, they are not. MSIE/FF are the De Facto browsers.

MSIE & FF are a subset = right.
MSIE & FF are a small subset = wrong.


I find this a very good argument.


I don't agree. You can safely state that Erwin's solution works in
most situations. This is a typical PointedEars-discussion, focussing
only on extremely unlikely, negligible conditions.

Indeed. I have discoivered that it doesn't work on an unripe walnut
plugged into a broadband line. Mind you, not much does.

Bad code, walnuts. Only fit for eating.
 
R

Richard Cornford

The Natural Philosopher wrote:
Indeed. It isn't even for public consumption really.
Its for an internal database.

If you are going to ask people for advice on a subject where design and
implementation decisions should be largely context driven it would be a
very good idea if you stated the real context along with the questions.
Otherwise you are just wasting people's time. It is the case that this
group's FAQ sates that the default assumption about the context will be
that questions asked relate to public web use if not stated otherwise.

I was looking for practical solutions, and Erwins
response is practical.
<snip>

You state that you did not want the 'new window' opening in a new tab.
You can take no action that will prevent that (even on the small sub-set
of browsers that interest you) as the users of some of those browsers
have an absolute veto on the outcome of window opening attempts. The
practical advice is to design a system that does not need to be opening
new windows, and in a controlled intranet context there are at least a
couple of ways of achieving that.

Richard.
 
T

The Natural Philosopher

Richard said:
The Natural Philosopher wrote:


If you are going to ask people for advice on a subject where design and
implementation decisions should be largely context driven it would be a
very good idea if you stated the real context along with the questions.
Otherwise you are just wasting people's time. It is the case that this
group's FAQ sates that the default assumption about the context will be
that questions asked relate to public web use if not stated otherwise.

Actually, I thought I had.
<snip>

You state that you did not want the 'new window' opening in a new tab.
You can take no action that will prevent that (even on the small sub-set
of browsers that interest you) as the users of some of those browsers
have an absolute veto on the outcome of window opening attempts. The
practical advice is to design a system that does not need to be opening
new windows, and in a controlled intranet context there are at least a
couple of ways of achieving that.

I would PREFER not to,
However you have to again realize the context: This is a company
application. If people want to screw their browsers around to not work
in the way intended, then they shouldn't complain.

Its possible to switch the PC off altogether, but that won't help them
get the job done..

In this context this is not an application intended for world
visibility. It is designed to USE a pretty small subset of browsers -
essentially FF2 and IE7, and maybe 6, as 'smart terminals' onto a
database application. They will NOT be routinely surfing the net from
these machines: They will be set up to talk to this application only,
and depending on the location, run a couple of laser cutters, some CAD
programs and financial packages.

All I want is a way to make it unlikley that FF2 or IE6,when set to
'open new window in new tab' will do that rather than pop up an overlay.
 
R

Richard Cornford

The said:
Actually, I thought I had.

Specifically, which of the statements in the question you asked do you
perceive as providing context information?
However you have to again realize the context: This is a company
application. If people want to screw their browsers around to not
work in the way intended, then they shouldn't complain.

They probably won't complain, nothing will stop working if any new
windows you attempt to open end up in a new tab. That was your
requirement not theirs. Your requirement cannot be achieved.

All I want is a way to make it unlikley that FF2 or IE6,when set
to 'open new window in new tab' will do that rather than pop up
an overlay.

There would be no point in making a browser configurable if it then did
not behave as configured.

Richard.
 

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

Forum statistics

Threads
474,172
Messages
2,570,935
Members
47,479
Latest member
JaysonK723

Latest Threads

Top