473,413 Members | 1,794 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Javascript & OS... Question ?

Hi all...
i'm currently working for a big project to construct a website.

We need to support some browser and OS : IE 5.0 -> IE 6, Mozilla 1.2
-> 1.7, Opera 5 -> Opéra 7.5x, Netscape 4.75 -> NS 7.2, Safari
and for OS : Win95/98/NT/Me/2000/XP, MacOS 9/10, Linux.

I have some problems with browser on different OS. For example i have
write a javascript who make a automatic submit when the page is
reload.

<script language="Javascript" for="window" event="onload()">
if( navigator.userAgent.indexOf("Opera") != -1 ){
setTimeout("document.forms[0].elements['btValider'].click();",1000);
}
else{
document.forms[0].submit();
}
</script>

This work fine on XP with Mozilla 1.6 but when i try Mozilla 1.6 on
Win98 or NT , i have no refresh and i need to click to the submit
button to send the form....

I'm searching the dependencies between Javascript and OS( or Browser
in different OS ). Someone can help me ??
All infos is accepted :)

Thanks
Regards
Florian Proch
Jul 23 '05 #1
5 1736


Florian Proch wrote:

i have
write a javascript who make a automatic submit when the page is
reload.

<script language="Javascript" for="window" event="onload()">
if( navigator.userAgent.indexOf("Opera") != -1 ){
setTimeout("document.forms[0].elements['btValider'].click();",1000);
}
else{
document.forms[0].submit();
}
</script>


<script for... event...
is something MS invented for IE but other browsers do not support that
usually, only Netscape 7.1 has some support for that on Windows I think
to allow scripting of Windows Media Player.
If you want to have an onload handler then you should use
<script type="text/javascript">
function loadHandler (evt) {
// your code to be executed onload goes here
}
</script>
...
<body onload="loadHandler(event);">
That should call the function with at least Netscape 4, 6/7, Mozilla,
Opera 6/7, IE 4/5/6, I can't say what Opera 5 did.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #2
Florian Proch wrote:
i'm currently working for a big project to construct a website.

We need to support some browser and OS :
For a web site supporting browsers would be a good idea :)
IE 5.0 -> IE 6, Mozilla 1.2 -> 1.7,
Opera 5 -> Opéra 7.5x,
I very much doubt that anyone is still using Opera 5 (and certainly
versions less than 5.12). Opera 5 -> Opera 7.5x will include the
extremely limited and buggy Opera 5.02. You will have your work cut out
getting much out of that one.
Netscape 4.75 -> NS 7.2, Safari
Netscape 6 versions were based on pre-release (0.9) versions of Mozilla.
They were unreliable and cranky and I would hope that everyone who
upgraded from Netscape 4 to 6 also moved on to the infinitely better
Netscape 7 versions when they became available.

Given that this list sets a minimum Mozilla version of 1.2 (and doesn't
mention Firefox at all) it doesn't seem like its creator knew much about
actual web browsers.
and for OS : Win95/98/NT/Me/2000/XP, MacOS 9/10, Linux.
Presumably this list of browsers features in some sort of specification
for the web site. Does the specification explicitly state javascript
enabled default configurations of the listed browsers or are you
expected to cope with all of there configuration permutations by
implication (including the option of turning javascript off)?
I have some problems with browser on different OS. For
example i have write a javascript who make a automatic
submit when the page is reload.

<script language="Javascript" for="window" event="onload()">
Martin has already explained why that SCRIPT tag is not going to be
useful.
if( navigator.userAgent.indexOf("Opera") != -1 ){
Don't do this. The - navigator.userAgent - string has no relationship
with the type or version of the browser (except by coincidence in a
limited number of cases):-

<URL: http://jibbering.com/faq/faq_notes/n...er_detect.html >
setTimeout("document.forms[0].elements['btValider'].click();",
1000);
} else{
document.forms[0].submit();
}
</script>
The automated submitting of forms can be disabled by configuration in
some of your listed browsers, and is also one of the things that can be
barred by content inserting/re-writing proxies (personal firewalls,
Internet security programmes, some types of advertising blockers, etc.).

However, submitting a form implies some sort of server-side scripting in
order to be useful. And automatically submitting a form as the page
loads implies that the form data is not going to be filled in by the
user but is pre-filled in (probably by a server-side script). Making
this no more than a mechanism for passing data around. As such it is
almost certainly the wrong way of doing this. There are many alternative
methods, but without knowing why you are attempting this in the first
palace (and the full context) it is impossible to suggest any one.
This work fine on XP with Mozilla 1.6 but when i try
Mozilla 1.6 on Win98 or NT , i have no refresh and i
need to click to the submit button to send the form....

I'm searching the dependencies between Javascript and
OS( or Browser in different OS ). Someone can help me ??
All infos is accepted :)


Javascript was standardised by the ECMA and all of browsers you list
implement, at minimum, a fairly consistent version of ECMA 262 2nd
edition (most implementing the 3rd edition).

On the other hand, the DOMs of the browsers listed vary enormously. You
have the very un-dynamic Opera <= 6, with minimal scriptable style
support and an incomplete W3C level 1 DOM. You have the monstrosity that
was Netscape 4, with its totally different approach to dynamic content
and extremely limited DOM. And then you have the latest all singing and
dancing Mozilla versions.

Unfortunate, on the evidence of what you have posted here as code and as
a question, I suspect that you are completely out of your depth. And are
probably 6 months of intensive research, experimentation and
cross-browser scripting, away from being able to cope with this project
well. In the meanwhile trying to learn 'on the job' will leave you
thrashing about (mostly ineffectually) putting code that is objectively
bad into a production web site at someone else's expense.

Assuming that you don't have the option of hiring someone who already
has the skills needed for the job, and that you actually care to be
doing the best job you are capable of doing for your client, you are
going to need a lot of help. You will be able to get some of that help
from comp.lang.javascript as the group has a distinct bias towards
cross-browser scripting, but you are going to have to optimise you
interactions with the group and put a lot of work in yourself. First
locate, read and familiarise yourself with the group's FAQ:-

<URL: http://jibbering.com/faq/ >

- paying particular attention to the advice on efficiently asking
questions that is linked to from section 2.3, and becoming familiar with
what is available at the various resources listed.

Richard.
Jul 23 '05 #3
fl***********@accenture.com (Florian Proch) writes:
<script language="Javascript" for="window" event="onload()">


As Martin Honnen said, this is your problem.
My suggestion for avoiding such problems is to make sure your HTML
validates. That should increase your chance of everything working.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #4
Martin Honnen wrote:
Florian Proch wrote:
i have
write a javascript who make a automatic submit when the page is
reload.

<script language="Javascript" for="window" event="onload()">
if( navigator.userAgent.indexOf("Opera") != -1 ){
setTimeout("document.forms[0].elements['btValider'].click();",1000);
}
else{
document.forms[0].submit();
}
</script>


<script for... event...
is something MS invented for IE but other browsers do not support that
usually, [...]


"event" (CDATA) and "for" (%URI) are attributes of the "script" element
defined in the HTML 4.01 Transitional and Strict DTDs but marked (by comment
only!) "reserved for possible future use", so no UA is required to implement
it. IE does and I would consider this a Good Thing as this follows the
standard. The main problem here is the missing "type" attribute which is
the only thing that makes this not Valid HTML, although IE really seems to
be the only UA to support the "event" and "for" attributes for the "script"
element (no matter where in the document it is located).

However, both attributes are not present in the XHTML 1.0 DTDs,
so apparently the arguments for the announced reservations "for
possible future use" were not sound enough to include them in
that XML reformulation of HTML.
PointedEars
Jul 23 '05 #5
Thomas 'Ingrid' Lahn wrote:
Martin Honnen wrote:
Florian Proch wrote:
[...]
<script language="Javascript" for="window" event="onload()">
[...]


<script for... event...
is something MS invented for IE but other browsers do not support that
usually, [...]


"event" (CDATA) and "for" (%URI) are attributes of the "script" element
defined in the HTML 4.01 Transitional and Strict DTDs but marked (by comment
only!) "reserved for possible future use", so no UA is required to implement
it. IE does and I would consider this a Good Thing as this follows the
standard. [...]


But even then the value of the "event" attribute must be the name of
an intrinsic event handler, that is, the parantheses must be omitted.
And the value of "for" must then be the ID of an element within the
document, not the identifier of a DOM object as seen here. I have
already mentioned the "type" attribute issue.
PointedEars
Jul 23 '05 #6

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

Similar topics

4
by: johkar | last post by:
When the output method is set to xml, even though I have CDATA around my JavaScript, the operaters of && and < are converted to XML character entities which causes errors in my JavaScript. I know...
5
by: nivas.meda | last post by:
Hi, I have an excel sheet with a graph and cells.If i change the value in the excel cells the graph will reflect.Now i am going to implement this functionality in html page.I successfully saved...
6
by: Alejandro Penate-Diaz | last post by:
Hi. I was handling key events nicely using some Javascript on my apps using something like this: this.txtUserName.Attributes.Add("onkeydown","if((event.which && event.which == 13)||(event.keyCode...
0
by: R L Vandaveer | last post by:
I am having an interesting and rather frustrating issue with the encoding/decoding of parameters with the ASP.NET runtime. What I am doing isn't exactly revolutionary so hopefully someone has an...
3
by: Nathan Sokalski | last post by:
I have a VB.NET function that I am using in an ASP.NET page. The code creates a String, which contains && (the JavaScript Logical AND operator) and is used as part of the JavaScript sent to the...
8
by: Nathan Sokalski | last post by:
I add a JavaScript event handler to some of my Webcontrols using the Attributes.Add() method as follows: Dim jscode as String = "return (event.keyCode>=65&&event.keyCode<=90);"...
11
by: Nathan Sokalski | last post by:
I add several JavaScript events (onchange, onkeypress, etc.) to Controls using the Add method of the Attributes collection. However, if the JavaScript code contains certain characters, such as & or...
2
by: Nathan Sokalski | last post by:
I am moving my website from my machine to my webhost, and need some help with what extra files I need to include due to the fact that I used AJAX in my site. Everything on the site is obviously...
3
by: DVir | last post by:
I am having problem with IE. This is the code that I am using, and it works good in every browser except in IE. If somebody can help PLEASE: <script language="Javascript" type="text/javascript">...
4
by: pmactdot | last post by:
Hi, I'm looking for some assistance on a case study...I have two arrays <head>: one for daily special dish name, second for the daily dish description, then I have two document.write: a daily...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.