From: Rainmanjam on
I have an issue with using window.onload with Safari. I am trying to
use Microsoft Live maps and it works with Firefox and IE. When I look
at the forums out there, there is a firing issue with window.onload
and safari. Here is the script I am running:

<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?
v=6" type="text/javascript"></script>
<script src="javascript/VEMapFunctions.js" type="text/javascript"></
script>
<script type="text/javascript">window.onload = GetMap;</script> //
getmap is in the js script
<title>
XXXXXXXX
</title></head>

<body>
<div id='myMap' style="position: relative; width: 750px; height:
500px;">
</body>


Should I be using something else?
From: Randy Webb on
Rainmanjam said the following on 12/24/2007 1:43 AM:
> I have an issue with using window.onload with Safari.

And what issue is that?

> I am trying to use Microsoft Live maps and it works with Firefox and
> IE. When I look at the forums out there, there is a firing issue with
> window.onload and safari.

And what issue is that?

> Here is the script I am running:
>
> <script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?
> v=6" type="text/javascript"></script>
> <script src="javascript/VEMapFunctions.js" type="text/javascript"></
> script>
> <script type="text/javascript">window.onload = GetMap;</script> //
> getmap is in the js script
> <title>
> XXXXXXXX
> </title></head>
>
> <body>
> <div id='myMap' style="position: relative; width: 750px; height:
> 500px;">
> </body>
> Should I be using something else?

Maybe something that will get you to explain what the issue is.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
From: Rainmanjam on
On Dec 23, 11:23 pm, Randy Webb <HikksNotAtH...(a)aol.com> wrote:
> Rainmanjam said the following on 12/24/2007 1:43 AM:
>
> > I have an issue with using window.onload with Safari.
>
> And what issue is that?
>
> > I am trying to use Microsoft Live maps and it works with Firefox and
> > IE. When I look at the forums out there, there is a firing issue with
> > window.onload and safari.
>
> And what issue is that?
>
There is a timing issue with Safari. Safari does not wait until the
page is loaded before running a window.onload. Therefor none of the
information in the VEMapFunctions.js run.
>
>
> > Here is the script I am running:
>
> > <script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?
> > v=6" type="text/javascript"></script>
> > <script src="javascript/VEMapFunctions.js" type="text/javascript"></
> > script>
> > <script type="text/javascript">window.onload = GetMap;</script> //
> > getmap is in the js script
> > <title>
> > XXXXXXXX
> > </title></head>
>
> > <body>
> > <div id='myMap' style="position: relative; width: 750px; height:
> > 500px;">
> > </body>
> > Should I be using something else?
>
> Maybe something that will get you to explain what the issue is.

http://ajaxian.com/archives/safari-3-onload-firing-and-bad-timing is
the issue. I don't know javascript well to insert this into the JS I
have currently.
> --
> Randy
> Chance Favors The Prepared Mind
> comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
> Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/

From: RobG on
On Dec 24, 5:34 pm, Rainmanjam <nject...(a)gmail.com> wrote:
> On Dec 23, 11:23 pm, Randy Webb <HikksNotAtH...(a)aol.com> wrote:> Rainmanjam said the following on 12/24/2007 1:43 AM:
>
> > > I have an issue with using window.onload with Safari.
>
> > And what issue is that?
>
> > > I am trying to use Microsoft Live maps and it works with Firefox and
> > > IE. When I look at the forums out there, there is a firing issue with
> > > window.onload and safari.
>
> > And what issue is that?
>
> There is a timing issue with Safari. Safari does not wait until the
> page is loaded before running a window.onload. Therefor none of the
> information in the VEMapFunctions.js run.

The page you referenced says quite specifically that Safari waits for
all resources to be loaded before firing onload, so you can't blame
that.

If you want to test it, use setTimeout to delay the call to your
function, then see how short the lag needs to be to get reliable
operation, e.g.:

window.onload = function() {
setTimeout('GetMap();', 0);
}


>
> > > Here is the script I am running:

A link to a page would be better.

[...]

--
Rob
From: Rainmanjam on
On Dec 23, 11:52 pm, RobG <rg...(a)iinet.net.au> wrote:
> On Dec 24, 5:34 pm, Rainmanjam <nject...(a)gmail.com> wrote:
>
> > On Dec 23, 11:23 pm, Randy Webb <HikksNotAtH...(a)aol.com> wrote:> Rainmanjam said the following on 12/24/2007 1:43 AM:
>
> > > > I have an issue with using window.onload with Safari.
>
> > > And what issue is that?
>
> > > > I am trying to use Microsoft Live maps and it works with Firefox and
> > > > IE. When I look at the forums out there, there is a firing issue with
> > > > window.onload and safari.
>
> > > And what issue is that?
>
> > There is a timing issue with Safari. Safari does not wait until the
> > page is loaded before running a window.onload. Therefor none of the
> > information in the VEMapFunctions.js run.
>
> The page you referenced says quite specifically that Safari waits for
> all resources to be loaded before firing onload, so you can't blame
> that.
>
> If you want to test it, use setTimeout to delay the call to your
> function, then see how short the lag needs to be to get reliable
> operation, e.g.:
>
> window.onload = function() {
> setTimeout('GetMap();', 0);
>
> }
>
> > > > Here is the script I am running:
>
> A link to a page would be better.
>
> [...]
>
> --
> Rob

http://njection.com/speedtrap

It works in IE and FF.. Not in Opera.