Safari Issue

G

GinnTech

I have a site that works perfectly in IE6 IE7 FF2 FF3 but not in the
latest Safari.

Here is the issue. I am attempting to call functions within a flash
object. When trying to attempt to retrieve the object to call the
functions IE6 IE7 FF2 FF3 all return Objects to work with. In Safari
a function is returned. Here is the code.

Code:
/
*******************************************************************************
**
** Advanced Distributed Learning Co-Laboratory (ADL Co-Lab) grants
you
** ("Licensee") a non-exclusive, royalty free, license to use, modify
and
** redistribute this software in source and binary code form, provided
that
** i) this copyright notice and license appear on all copies of the
software;
** and ii) Licensee does not utilize the software in a manner which
is
** disparaging to ADL Co-Lab.
**
** This software is provided "AS IS," without a warranty of any kind.
ALL
** EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
INCLUDING
** ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE
** OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.  ADL Co-Lab AND ITS
LICENSORS
** SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
RESULT OF
** USING, MODIFYING OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES.
IN NO
** EVENT WILL ADL Co-Lab OR ITS LICENSORS BE LIABLE FOR ANY LOST
REVENUE,
** PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
** INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF
THE
** THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE
** SOFTWARE, EVEN IF ADL Co-Lab HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH
** DAMAGES.
**
*******************************************************************************/

/
*******************************************************************************
** This file is part of the ADL Sample API Implementation intended to
provide
** an elementary example of the concepts presented in the ADL Sharable
** Content Object Reference Model (SCORM).
**
** The file is used by the run time environment to maintain internal
communication
** within the frames of the environment.
**
*******************************************************************************/

var _Debug = true;  // set this to false to turn debugging off
// and get rid of those annoying alert boxes.


// local variable definitions
var apiHandle = null;
var API = null;
var findAPITries = 0;


/
*******************************************************************************
**
** Function: doInit()
** Inputs:  none
** Return:  false if the API handle cannot be located
**
** Description: gets the API handle and sets up necessary api variable
values
**
**
*******************************************************************************/
function initAPI()
{
var api = getAPIHandle();
if (api == null)
{
alert("Unable to locate the RTE's API Implementation");
return "false";
}
else
{
api.setActivityID( document.forms[0].activityID.value );
api.setCourseID( document.forms[0].courseID.value );
api.setStateID( document.forms[0].stateID.value );
api.setUserID( document.forms[0].userID.value );
api.setUserName( document.forms[0].userName.value );
api.setNumAttempts( document.forms[0].numAttempts.value );
api.clearState();
}
}


/
******************************************************************************
**
** Function getAPIHandle()
** Inputs:  None
** Return:  value contained by APIHandle
**
** Description:
** Returns the handle to API object if it was previously set,
** otherwise it returns null
**
*******************************************************************************/
function getAPIHandle()
{
if (apiHandle == null)
{
apiHandle = getAPI();
}
return apiHandle;
}


/
*******************************************************************************
**
** Function findAPI(win)
** Inputs:  win - a Window Object
** Return:  If an API object is found, it's returned, otherwise null
is returned
**
** Description:
** This function looks for an object named API in parent and opener
windows
**
*******************************************************************************/
function findAPI(win)
{

while ((win.API_1484_11 == null) && (win.parent != null) &&
(win.parent != win))
{
findAPITries++;
// Note: 500 is a number based on the IEEE API Standards.
if ( findAPITries > 500 )
{
alert("Error finding API -- too deeply nested.");
return null;
}

win = win.parent;

}
//ToDo:Start Here Debugging how to get Safari to see this object.
return win.API_1484_11;
}



/
*******************************************************************************
**
** Function getAPI()
** Inputs:  none
** Return:  If an API object is found, it's returned, otherwise null
is returned
**
** Description:
** This function looks for an object named API, first in the current
window's
** frame hierarchy and then, if necessary, in the current window's
opener window
** hierarchy (if there is an opener window).
**
*******************************************************************************/
function getAPI()
{
var theAPI = findAPI(window);
if ((theAPI == null) && (window.opener != null) &&
(typeof(window.opener) != "undefined"))
{
theAPI = findAPI(window.opener);
}
if (theAPI == null)
{
alert("RTE - Can not locate API adapter");
}
return theAPI
}

The code errors at
api.setActivityID( document.forms[0].activityID.value );

with
Value undefined(result of expression api.setActivityID) is not
object.

Low and behold it's not an object it's a function in the eyes of
safari.

Does anyone know a work around for this in safari.

Thank you,

Tim
 
T

Thomas 'PointedEars' Lahn

GinnTech said:
I have a site that works perfectly in IE6 IE7 FF2 FF3 but not in the
latest Safari.

Here is the issue. I am attempting to call functions within a flash
object. When trying to attempt to retrieve the object to call the
functions IE6 IE7 FF2 FF3 all return Objects to work with. In Safari
a function is returned. Here is the code.

Code:
[/QUOTE]

This is Usenet.  Do not bother (us) with pseudo-tags.
[QUOTE]
[...]
// local variable definitions[/QUOTE]

How can these be local variable definitions when they are in fact *global*
variable *declarations*?
[QUOTE]
var apiHandle = null;
var API = null;[/QUOTE]

This variable is never read.
[QUOTE]
var findAPITries = 0;

[...]
function initAPI()
{
var api = getAPIHandle();[/QUOTE]

A local variable named `api' is declared and initialized here.
[QUOTE]
if (api == null)
{
alert("Unable to locate the RTE's API Implementation");
return "false";
}
else
{[/QUOTE]

Since execution continues in this branch, getAPIHandle() would return a
value that is not equal to `null' after type conversion.
[QUOTE]
api.setActivityID( document.forms[0].activityID.value );[/QUOTE]

Since an error occurs when calling the method, getAPIHandle() would return a
value that is either not an object reference (but not equal to `null' after
type conversion) or the object referred to would not have such a method.
[QUOTE]
[...]
}
}

[...]
function getAPIHandle()
{
if (apiHandle == null)
{
apiHandle = getAPI();
}
return apiHandle;
}


[...]
function findAPI(win)
{

while ((win.API_1484_11 == null) && (win.parent != null) &&
(win.parent != win))
{
findAPITries++;
// Note: 500 is a number based on the IEEE API Standards.
if ( findAPITries > 500 )
{
alert("Error finding API -- too deeply nested.");
return null;
}

win = win.parent;

}
	//ToDo:Start Here Debugging how to get Safari to see this object. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return win.API_1484_11;
}[/QUOTE]

As everything boils down to this method, the problem that causes the error
in the first place is to be found in there.  But ISTM debugging needs to be
started on top of it.
[QUOTE]
[...]
function getAPI()
{
var theAPI = findAPI(window);
if ((theAPI == null) && (window.opener != null) &&
(typeof(window.opener) != "undefined"))
{
theAPI = findAPI(window.opener);
}
if (theAPI == null)
{
alert("RTE - Can not locate API adapter");
}
return theAPI
}

[...]
The code errors at
api.setActivityID( document.forms[0].activityID.value );

with
Value undefined(result of expression api.setActivityID) is not
object.

Low and behold it's not an object it's a function in the eyes of
safari.[/QUOTE]

Utter nonsense.  Safari very clearly says that the result of
api.setActivityID, which is the `undefined' value is not an
object (and so also no Function object).
[QUOTE]
Does anyone know a work around for this in safari.[/QUOTE]

if (api)

instead of

if (api == null)

might suffice to avoid the runtime error.

Nevertheless, the code would still have several other issues.


PointedEars
 
R

RobG

GinnTech said:
I have a site that works perfectly in IE6 IE7 FF2 FF3 but not in the
latest Safari.

Here is the issue. I am attempting to call functions within a flash
object. When trying to attempt to retrieve the object to call the
functions IE6 IE7 FF2 FF3 all return Objects to work with. In Safari
a function is returned. Here is the code.

Code:
/
*******************************************************************************[/QUOTE]

Please wrap code for posting at about 70 characters to avoide errors
being introduced by auto-wrapping.  Code should be able to be cut and
pasted without any additional syntax errors.

[...][QUOTE]
/
*******************************************************************************
** This file is part of the ADL Sample API Implementation intended to
provide
** an elementary example of the concepts presented in the ADL Sharable
** Content Object Reference Model (SCORM).
**
** The file is used by the run time environment to maintain internal
communication
** within the frames of the environment.
**
*******************************************************************************/

var _Debug = true;  // set this to false to turn debugging off
// and get rid of those annoying alert boxes.


// local variable definitions[/QUOTE]

They're global.
[QUOTE]
var apiHandle = null;
var API = null;[/QUOTE]

Unused variable
[QUOTE]
var findAPITries = 0;


/
**
**
** Function: doInit()[/QUOTE]

It's called doInit here...
[QUOTE]
** Inputs:  none
** Return:  false if the API handle cannot be located
**
** Description: gets the API handle and sets up necessary api variable
values
**
**
*******************************************************************************/[/QUOTE]

and initAPI here
[QUOTE]
function initAPI()
{
var api = getAPIHandle();[/QUOTE]

getAPIHandle() returns the result of a call to getAPI(), which in turn
calls findAPI(window).  For me, api is set to undefined.

[QUOTE]
if (api == null)[/QUOTE]

It isn't null, it's undefined but the test returns true anyway.  Consider:

if (typeof api != 'object');
[QUOTE]
{
alert("Unable to locate the RTE's API Implementation");
return "false";[/QUOTE]

Do you really mean to return the string 'false' or the boolean value false?

[QUOTE]
}
else
{
api.setActivityID( document.forms[0].activityID.value );
api.setCourseID( document.forms[0].courseID.value );
api.setStateID( document.forms[0].stateID.value );
api.setUserID( document.forms[0].userID.value );
api.setUserName( document.forms[0].userName.value );
api.setNumAttempts( document.forms[0].numAttempts.value );
api.clearState();
}
}


/
******************************************************************************
**
** Function getAPIHandle()
** Inputs:  None
** Return:  value contained by APIHandle
**
** Description:
** Returns the handle to API object if it was previously set,
** otherwise it returns null
**
*******************************************************************************/
function getAPIHandle()
{
if (apiHandle == null)
{
apiHandle = getAPI();
}
return apiHandle;
}


/
*******************************************************************************
**
** Function findAPI(win)
** Inputs:  win - a Window Object
** Return:  If an API object is found, it's returned, otherwise null
is returned[/QUOTE]

It seems it will return the result of win.API_1484_11, which is likely
to be undefined, not null.
[QUOTE]
**
** Description:
** This function looks for an object named API in parent and opener
windows
**
*******************************************************************************/
function findAPI(win)
{

while ((win.API_1484_11 == null) && (win.parent != null) &&
(win.parent != win))[/QUOTE]

A reference to the window object is passed to win, the first two tests
are true but the last is false, so the while loop is never entered.

[QUOTE]
{
findAPITries++;
// Note: 500 is a number based on the IEEE API Standards.
if ( findAPITries > 500 )
{
alert("Error finding API -- too deeply nested.");
return null;
}

win = win.parent;

}
	//ToDo:Start Here Debugging how to get Safari to see this object.
return win.API_1484_11;[/QUOTE]

That returns undefined for me, not null as specified in the documentation.
[QUOTE]
}



/
*******************************************************************************
**
** Function getAPI()
** Inputs:  none
** Return:  If an API object is found, it's returned, otherwise null
is returned
**
** Description:
** This function looks for an object named API, first in the current
window's
** frame hierarchy and then, if necessary, in the current window's
opener window
** hierarchy (if there is an opener window).
**
*******************************************************************************/
function getAPI()
{
var theAPI = findAPI(window);
if ((theAPI == null) && (window.opener != null) &&
(typeof(window.opener) != "undefined"))
{
theAPI = findAPI(window.opener);
}
if (theAPI == null)
{
alert("RTE - Can not locate API adapter");
}
return theAPI
}

The code errors at
api.setActivityID( document.forms[0].activityID.value );

You don't show how you call the code, calling getAPI from window.onload
gives "RTE - Can not locate API adapter"

with
Value undefined(result of expression api.setActivityID) is not
object.

Low and behold it's not an object it's a function in the eyes of
safari.

The code you posted doesn't do that for me. Perhaps you should post a
link to a minimal example that shows the error.
 
G

GinnTech

GinnTech said:
I have a site that works perfectly in IE6 IE7 FF2 FF3 but not in the
latest Safari.
Here is the issue.  I am attempting to call functions within a flash
object.  When trying to attempt to retrieve the object to call the
functions IE6 IE7 FF2 FF3 all return Objects to work with.  In Safari
a function is returned.  Here is the code.
Code:
/
*******************************************************************************[/QUOTE]

Please wrap code for posting at about 70 characters to avoide errors
being introduced by auto-wrapping.  Code should be able to be cut and
pasted without any additional syntax errors.

[...]


[QUOTE]
/
*******************************************************************************
** This file is part of the ADL Sample API Implementation intended to
provide
** an elementary example of the concepts presented in the ADL Sharable
** Content Object Reference Model (SCORM).
**
** The file is used by the run time environment to maintain internal
communication
** within the frames of the environment.
**
*******************************************************************************/[/QUOTE]
[QUOTE]
var _Debug = true;  // set this to false to turn debugging off
                     // and get rid of those annoying alert boxes.[/QUOTE]
[QUOTE]
// local variable definitions[/QUOTE]

They're global.
[QUOTE]
var apiHandle = null;
var API = null;[/QUOTE]

Unused variable
[QUOTE]
var findAPITries = 0;[/QUOTE]
[QUOTE]
/
**
**
** Function: doInit()[/QUOTE]

It's called doInit here...
[QUOTE]
** Inputs:  none
** Return:  false if the API handle cannot be located
**
** Description: gets the API handle and sets up necessary api variable
values
**
**
*******************************************************************************/[/QUOTE]

and initAPI here
[QUOTE]
function initAPI()
{
   var api = getAPIHandle();[/QUOTE]

getAPIHandle() returns the result of a call to getAPI(), which in turn
calls findAPI(window).  For me, api is set to undefined.
[QUOTE]
   if (api == null)[/QUOTE]

It isn't null, it's undefined but the test returns true anyway.  Consider:

     if (typeof api != 'object');
[QUOTE]
   {
      alert("Unable to locate the RTE's API Implementation");
      return "false";[/QUOTE]

Do you really mean to return the string 'false' or the boolean value false?


[QUOTE]
   }
   else
   {
       api.setActivityID( document.forms[0].activityID.value );
       api.setCourseID( document.forms[0].courseID.value );
       api.setStateID( document.forms[0].stateID.value );
       api.setUserID( document.forms[0].userID.value );
       api.setUserName( document.forms[0].userName.value );
       api.setNumAttempts( document.forms[0].numAttempts.value );
       api.clearState();
    }
}[/QUOTE]
[QUOTE]
/
******************************************************************************
**
** Function getAPIHandle()
** Inputs:  None
** Return:  value contained by APIHandle
**
** Description:
** Returns the handle to API object if it was previously set,
** otherwise it returns null
**
*******************************************************************************/
function getAPIHandle()
{
   if (apiHandle == null)
   {
      apiHandle = getAPI();
   }
   return apiHandle;
}[/QUOTE]
[QUOTE]
/
*******************************************************************************
**
** Function findAPI(win)
** Inputs:  win - a Window Object
** Return:  If an API object is found, it's returned, otherwise null
is returned[/QUOTE]

It seems it will return the result of win.API_1484_11, which is likely
to be undefined, not null.
[QUOTE]
**
** Description:
** This function looks for an object named API in parent and opener
windows
**
*******************************************************************************/
function findAPI(win)
{[/QUOTE]
[QUOTE]
   while ((win.API_1484_11 == null) && (win.parent != null) &&
(win.parent != win))[/QUOTE]

A reference to the window object is passed to win, the first two tests
are true but the last is false, so the while loop is never entered.
[QUOTE]
   {
      findAPITries++;
      // Note: 500 is a number based on the IEEE API Standards.
      if ( findAPITries > 500 )
      {
         alert("Error finding API -- too deeply nested.");
         return null;
      }[/QUOTE]
[QUOTE]
      win = win.parent;[/QUOTE]
[QUOTE]
   }
   //ToDo:Start Here Debugging how to get Safari to see this object..
   return win.API_1484_11;[/QUOTE]

That returns undefined for me, not null as specified in the documentation..


[QUOTE]
}[/QUOTE]
[QUOTE]
/
*******************************************************************************
**
** Function getAPI()
** Inputs:  none
** Return:  If an API object is found, it's returned, otherwise null
is returned
**
** Description:
** This function looks for an object named API, first in the current
window's
** frame hierarchy and then, if necessary, in the current window's
opener window
** hierarchy (if there is an opener window).
**
*******************************************************************************/
function getAPI()
{
   var theAPI = findAPI(window);
   if ((theAPI == null) && (window.opener != null) &&
(typeof(window.opener) != "undefined"))
   {
      theAPI = findAPI(window.opener);
   }
   if (theAPI == null)
   {
      alert("RTE - Can not locate API adapter");
   }
   return theAPI
} [QUOTE]

The code errors at
       api.setActivityID( document.forms[0].activityID.value );

You don't show how you call the code, calling getAPI from window.onload
gives "RTE - Can not locate API adapter"
with
Value undefined(result of expression api.setActivityID) is not
object.
Low and behold it's not an object it's a function in the eyes of
safari.

The code you posted doesn't do that for me.  Perhaps you should post a
link to a minimal example that shows the error.
[/QUOTE]


Ok I think that the point of the question is being missed here. The
Code works fine. It's passed SCORM compliance and does exactly what
it is supposed to do in every other browser except Safari. I did not
write this code. I am only modifying it to work with Safari.

Do to security issues I can not show or tell you how this code is
used. I don't want to end up in Guantanamo Bay for violating
government privacy rules.

The API_1484_11 is a variable on the parent page that points to a
Flash Object. When I get back to the office on MOnday I will include
that code. I wouldn't get so caught up in the code so much as how in
the world in Safari can I find this object and reference it as an
object and not what is happening now it's being found but is being
referenced as a function.

Thank you for your help.

Tim
 
G

GinnTech

GinnTech said:
I have a site that works perfectly in IE6 IE7 FF2 FF3 but not in the
latest Safari.
Here is the issue.  I am attempting to call functions within a flash
object.  When trying to attempt to retrieve the object to call the
functions IE6 IE7 FF2 FF3 all return Objects to work with.  In Safari
a function is returned.  Here is the code.
Code:
/
*******************************************************************************[/QUOTE]

Please wrap code for posting at about 70 characters to avoide errors
being introduced by auto-wrapping.  Code should be able to be cut and
pasted without any additional syntax errors.

[...]


[QUOTE]
/
*******************************************************************************
** This file is part of the ADL Sample API Implementation intended to
provide
** an elementary example of the concepts presented in the ADL Sharable
** Content Object Reference Model (SCORM).
**
** The file is used by the run time environment to maintain internal
communication
** within the frames of the environment.
**
*******************************************************************************/[/QUOTE]
[QUOTE]
var _Debug = true;  // set this to false to turn debugging off
                     // and get rid of those annoying alert boxes.[/QUOTE]
[QUOTE]
// local variable definitions[/QUOTE]

They're global.
[QUOTE]
var apiHandle = null;
var API = null;[/QUOTE]

Unused variable
[QUOTE]
var findAPITries = 0;[/QUOTE]
[QUOTE]
/
**
**
** Function: doInit()[/QUOTE]

It's called doInit here...
[QUOTE]
** Inputs:  none
** Return:  false if the API handle cannot be located
**
** Description: gets the API handle and sets up necessary api variable
values
**
**
*******************************************************************************/[/QUOTE]

and initAPI here
[QUOTE]
function initAPI()
{
   var api = getAPIHandle();[/QUOTE]

getAPIHandle() returns the result of a call to getAPI(), which in turn
calls findAPI(window).  For me, api is set to undefined.
[QUOTE]
   if (api == null)[/QUOTE]

It isn't null, it's undefined but the test returns true anyway.  Consider:

     if (typeof api != 'object');
[QUOTE]
   {
      alert("Unable to locate the RTE's API Implementation");
      return "false";[/QUOTE]

Do you really mean to return the string 'false' or the boolean value false?


[QUOTE]
   }
   else
   {
       api.setActivityID( document.forms[0].activityID.value );
       api.setCourseID( document.forms[0].courseID.value );
       api.setStateID( document.forms[0].stateID.value );
       api.setUserID( document.forms[0].userID.value );
       api.setUserName( document.forms[0].userName.value );
       api.setNumAttempts( document.forms[0].numAttempts.value );
       api.clearState();
    }
}[/QUOTE]
[QUOTE]
/
******************************************************************************
**
** Function getAPIHandle()
** Inputs:  None
** Return:  value contained by APIHandle
**
** Description:
** Returns the handle to API object if it was previously set,
** otherwise it returns null
**
*******************************************************************************/
function getAPIHandle()
{
   if (apiHandle == null)
   {
      apiHandle = getAPI();
   }
   return apiHandle;
}[/QUOTE]
[QUOTE]
/
*******************************************************************************
**
** Function findAPI(win)
** Inputs:  win - a Window Object
** Return:  If an API object is found, it's returned, otherwise null
is returned[/QUOTE]

It seems it will return the result of win.API_1484_11, which is likely
to be undefined, not null.
[QUOTE]
**
** Description:
** This function looks for an object named API in parent and opener
windows
**
*******************************************************************************/
function findAPI(win)
{[/QUOTE]
[QUOTE]
   while ((win.API_1484_11 == null) && (win.parent != null) &&
(win.parent != win))[/QUOTE]

A reference to the window object is passed to win, the first two tests
are true but the last is false, so the while loop is never entered.
[QUOTE]
   {
      findAPITries++;
      // Note: 500 is a number based on the IEEE API Standards.
      if ( findAPITries > 500 )
      {
         alert("Error finding API -- too deeply nested.");
         return null;
      }[/QUOTE]
[QUOTE]
      win = win.parent;[/QUOTE]
[QUOTE]
   }
   //ToDo:Start Here Debugging how to get Safari to see this object..
   return win.API_1484_11;[/QUOTE]

That returns undefined for me, not null as specified in the documentation..


[QUOTE]
}[/QUOTE]
[QUOTE]
/
*******************************************************************************
**
** Function getAPI()
** Inputs:  none
** Return:  If an API object is found, it's returned, otherwise null
is returned
**
** Description:
** This function looks for an object named API, first in the current
window's
** frame hierarchy and then, if necessary, in the current window's
opener window
** hierarchy (if there is an opener window).
**
*******************************************************************************/
function getAPI()
{
   var theAPI = findAPI(window);
   if ((theAPI == null) && (window.opener != null) &&
(typeof(window.opener) != "undefined"))
   {
      theAPI = findAPI(window.opener);
   }
   if (theAPI == null)
   {
      alert("RTE - Can not locate API adapter");
   }
   return theAPI
} [QUOTE]

The code errors at
       api.setActivityID( document.forms[0].activityID.value );

You don't show how you call the code, calling getAPI from window.onload
gives "RTE - Can not locate API adapter"
with
Value undefined(result of expression api.setActivityID) is not
object.
Low and behold it's not an object it's a function in the eyes of
safari.

The code you posted doesn't do that for me.  Perhaps you should post a
link to a minimal example that shows the error.
[/QUOTE]

Oh and this is all iniciated by calling the initAPI() the child
page.
API_1484_11 is already instantiated on the parent page by the code I
will post tomorrow morning. The functions that are being called
api.set.... are inside the flash ojbect and are set for full access.

Thanks Tim
 
T

Thomas 'PointedEars' Lahn

GinnTech said:
Ok I think that the point of the question is being missed here. The Code
works fine.

Obviously it does not.
It's passed SCORM compliance

Which has nothing to do with it being incompatible code.
and does exactly what it is supposed to do in every other browser except
Safari.

That is indicative of bad code, because the features used are of "DOM Level
0" which all UAs whould support (even Safari). What is your "every other
browser" anyway? (I suppose only IE and Fx.)
I did not write this code.

And so you are not willing to help us help you fix it?
I am only modifying it to work with Safari.

Good luck. You have been told what to do already.
Do to security issues I can not show or tell you how this code is used. I
don't want to end up in Guantanamo Bay for violating government privacy
rules.

Don't you play stupid, please.
The API_1484_11 is a variable on the parent page that points to a Flash
Object.

But either the algorithm to retrieve it does not work properly in Safari or
there is no such object in Safari. So you need to find out the cause of
this if it should work in Safari.
I wouldn't get so caught up in the code so much as how in the world in
Safari can I find this object and reference it as an object and not what
is happening

You are not making sense.
now it's being found but is being referenced as a function.

How did you get that idea?


PointedEars
 
G

GinnTech

The API_1484_11 is a variable on the parent page that points to a Flash

But either the algorithm to retrieve it does not work properly in
Safari or
there is no such object in Safari. So you need to find out the cause
of
this if it should work in Safari.

Now your on point this is the exact problem with safari. And yes I do
need to find out what the cause of this with Safari that is why I
posted this.
now it's being found but is being referenced as a function.

How did you get that idea?

Insert typeof(api) in FF2, FF3, IE6, IE7, and Opera it returns as an
object. In safari it returns as a function, that is how.

Now if anyone can help with this issue and not just a need to take
sarcastic shots on forums I would be greatly appreciative of the
help. There has to be a work around for if the object returns as a
function (if(typeof(api) = 'function'){...}) an alternative to get it
as an object. It has to be an issue with locating it in the parent
because it works correctly is your code is executed on the page the
object is located, this 'feature' only occurs when you are trying to
access the object from a parent window.

Thank you,
Tim
 
D

David Mark

But either the algorithm to retrieve it does not work properly in
Safari or
there is no such object in Safari.  So you need to find out the cause
of
this if it should work in Safari.

Now your on point this is the exact problem with safari.  And yes I do
need to find out what the cause of this with Safari that is why I
posted this.


How did you get that idea?

Insert typeof(api) in FF2, FF3, IE6, IE7, and Opera it returns as an
object.  In safari it returns as a function, that is how.

You aren't making any sense. Functions are objects in JavaScript and
the exception Safari threw did not indicate an object of any kind.

Were you joking before or is this really an example of my tax dollars
at work?
 
R

RobG

Please trim quotes and do not remove attribution. Posting order
restored (more or less...).
Now your on point this is the exact problem with safari. And yes I do
need to find out what the cause of this with Safari that is why I
posted this.

Then why are you looking in the child page and not the code that sets
the value of API?

Insert typeof(api) in FF2, FF3, IE6, IE7, and Opera it returns as an
object. In safari it returns as a function, that is how.

Where did you insert that? It seems that you are looking for a bug at
a point well beyond where the error appears to have occurred.

There has to be a work around for if the object returns as a
function (if(typeof(api) = 'function'){...}) an alternative to get it
as an object. It has to be an issue with locating it in the parent
because it works correctly is your code is executed on the page the
object is located, this 'feature' only occurs when you are trying to
access the object from a parent window.

What I think you are saying is that the API object is created in the
parent page, then a child page attempts to get a reference to it. You
seem to have posted code from the child page which is getting a
reference to an object that you didn't expect, so the error seems to
be occurring in the parent page.

That is, it is the setting of the value of API that is in error.
Incidentally, whether it is a Function object or an Object object
should not affect the ability to add properties to it. However it
does indicate that whatever is setting the value of API is possibly
setting it incorrectly.

You advise us that API is set by code inside the Flash object, so that
is where you should be looking.
 
G

GinnTech

Please trim quotes and do not remove attribution.  Posting order
restored (more or less...).



Then why are you looking in the child page and not the code that sets
the value of API?



Where did you insert that?  It seems that you are looking for a bug at
a point well beyond where the error appears to have occurred.


What I think you are saying is that the API object is created in the
parent page, then a child page attempts to get a reference to it.  You
seem to have posted code from the child page which is getting a
reference to an object that you didn't expect, so the error seems to
be occurring in the parent page.

That is, it is the setting of the value of API that is in error.
Incidentally, whether it is a Function object or an Object object
should not affect the ability to add properties to it.  However it
does indicate that whatever is setting the value of API is possibly
setting it incorrectly.

You advise us that API is set by code inside the Flash object, so that
is where you should be looking.

Now we are getting some where.

just to clear the api object references functions within the flash
video.

I would agree with you on the fact that this issue may originate in
the parent page and not the child but the issue still remains
regardless of where it's chosen to be fixed. I don't believe it is an
issue in the parent as that all code functions as designed in the
parent when the parents object is referenced in that page. IF the
issue presented its self in the parent the error would exist in that
page as well and it doesn't.

In regards to the typeof() calls position. I placed it in the
initAPI() function after the return, in addition I placed it in the
findAPI() and getAPIHandle() functions. All in safari at all points
return a type of 'function' and 'object' in all previously mentioned
browsers. I have found articles of this being an issue with Safari on
the Apple Support Forums but all conversation stops at the point of
identifying the issue and no work around for it.


Diagram of the work

parent(flash > applet > business logic > data layer)
child((parent applet) > flash > business logic > data layer)

Tim

in this case the child applet is getting parent(profile and test) data
and then setting data into it's flash object to transfer
data(scores,times, and responses)
 
G

GinnTech

You aren't making any sense.  Functions are objects in JavaScript and
the exception Safari threw did not indicate an object of any kind.

Were you joking before or is this really an example of my tax dollars
at work?

As much as I hate to say it yes, anyway possibly I am not being clear
with the results.

object as in a class object

var test = new foo();
test.bar()

I should be getting back test not bar();

probably more confusing, maybe not.

if you take a paragraph tag var test = document.getElementById('some
paragraph') you will get back an object and you can call functions of
that object and so on. if you ran typeof(test) you would return
'object', in my issue with safari that is returning 'function' so you
can't access test.style test.id and so on.

Make sence?
 
D

David Mark

As much as I hate to say it yes, anyway possibly I am not being clear
with the results.

Quite possibly, but that is not the issue at hand.
object as in a class object

A what?
var test = new foo();
test.bar()

I should be getting back test not bar();

probably more confusing, maybe not.

You are clearly very confused.
if you take a paragraph tag var test = document.getElementById('some
paragraph')  you will get back an object and you can call functions of

Not with that ID you won't.
that object and so on.  if you ran typeof(test)  you would return
'object', in my issue with safari that is returning 'function'  so you

There's really no telling what it would return (though "object" is
quite common.)
can't access test.style test.id and so on.

Just because it returns "function?" Think again.
Make sence?

I have understand that you don't understand what you are doing and
therefore cannot analyze or articulate your problem very well. I
certainly hope this isn't a critical project.
 
G

GinnTech

Please trim quotes and do not remove attribution.  Posting order
restored (more or less...).



Then why are you looking in the child page and not the code that sets
the value of API?



Where did you insert that?  It seems that you are looking for a bug at
a point well beyond where the error appears to have occurred.


What I think you are saying is that the API object is created in the
parent page, then a child page attempts to get a reference to it.  You
seem to have posted code from the child page which is getting a
reference to an object that you didn't expect, so the error seems to
be occurring in the parent page.

That is, it is the setting of the value of API that is in error.
Incidentally, whether it is a Function object or an Object object
should not affect the ability to add properties to it.  However it
does indicate that whatever is setting the value of API is possibly
setting it incorrectly.

You advise us that API is set by code inside the Flash object, so that
is where you should be looking.

Rob

Here is some more information on the issue I am seeing if this helps.
And maybe for those unnamed who believe this to all be a farse.

Built-in functions are not objects

Permalink | Safari | 1 comments
Reported on 17 August 2007

Built-in functions in Safari are not Function objects, and not even
Object objects. They appear to be of type "function" instead of type
"object". This makes it impossible to use .call() and .apply() on
them.

(ppknote: Safari 3 gives window.alert instanceof Object: true. 1.3
doesn't, though.)

Test page Workaround is not included
Reported by: Mihail Milushev.


This can be found at http://www.quirksmode.org/bugreports/archives/safari/index.html

Tim
 
T

Thomas 'PointedEars' Lahn

Which part of that did you not get, Google Groups idiot?
[snipped hundreds of irrelevant lines]
Here is some more information on the issue I am seeing if this helps.

Of course it will not as it has nothing to do with it, half-wit. Safari
very clearly says that your *object* is not there, so it does not matter
what `typeof' would yield for its method.
And maybe for those unnamed who believe this to all be a farse.

Nobody implied that, luser.

(I usually do not reply like this, but maybe that's the kind of language you
are going to understand ...)


PointedEars
 
H

Henry

On Aug 11, 3:44 pm, GinnTech wrote:
Here is some more information on the issue I am seeing if
this helps. And maybe for those unnamed who believe this
to all be a farse.

Built-in functions are not objects
<snip>

Your issue is with host objects/methods not built-in functions.
Built-in functions in Safari are not Function objects, and
not even Object objects. They appear to be of type "function"
instead of type "object". This makes it impossible to use
.call() and .apply() on them.

(ppknote: Safari 3 gives window.alert instanceof Object:
true. 1.3 doesn't, though.)

Test page Workaround is not included

This "test page" applies its tests to - window.alert -, which is not a
built-in function, it is a host method/function. And being a host
method/function there is no reason to expect it to have any particular
object on its prototype chain, to inherit any methods through its
prototype chain or to have any particular - prototype - property (or
have such a property at all). Without any specified requirements upon
- window.alert - it is not possible for any behaviour it may exhibit
to be regarded as a bug; thus the bug report is bogus.
 
G

GinnTech

On Aug 11, 3:44 pm, GinnTech wrote:



<snip>

Your issue is with host objects/methods not built-in functions.




This "test page" applies its tests to - window.alert -, which is not a
built-in function, it is a host method/function. And being a host
method/function there is no reason to expect it to have any particular
object on its prototype chain, to inherit any methods through its
prototype chain or to have any particular - prototype - property (or
have such a property at all). Without any specified requirements upon
- window.alert - it is not possible for any behaviour it may exhibit
to be regarded as a bug; thus the bug report is bogus.

Ok I can accept that. But I still have the issue. With debugging
today I was able to make a change implimenting the prototype framework
and get the API_1484_11 Object to return as an 'object' and not a
function using $('API_1484_11').

After fixing this issue the issue reared it's head on another object
being accessed on the page called 'TaskShell'. I tried the same $()
function on it hopefully fixing it here as well. To no avail at this
point in the code it still returns as a 'function'.

Here is the code

function getID(swfID) {
if (navigator.appName.indexOf("Microsoft") > -1) {
alert("Thinks it's Microsoft");
flash = window[swfID];
} else {
alert("Thinks it's Something else - safari/ff/Opera/other");
flash = document[swfID];
//alert(document[swfID].length);
//flash = document.getElementsByName(swfID)[0];
if(document[swfID].length != undefined){//ff/Opera
alert("Thinks it's defined");
flash = document[swfID][1];
return;
}else{//Safari
alert("Thinks it's undefined");
flash = document.getElementsByName('TaskShell')[0];
// flash = $(swfID);
alert(typeof(flash));
return;
}
// flash = document[swfID];
// return;
}
}
//initialize the flash shell on this page (called from initLMS())
function initFlashShell(){
//get reference to flash shell
getID('TaskShell');

//initialize LMS API object
initLMS();

//initShell is in TaskShell.swf
//send launch data for progress bar
try{
$('TaskShell').initShell(API_1484_11.GetValue("cmi.launch_data")
+"&"+"<%=data %>");//Attempt to try and access it with prototype}
catch(e){
alert(e.toString());
}
//flash.initShell(API_1484_11.GetValue("cmi.launch_data")+"&"+"<
%=data %>");
}

element it is trying to get
<script type="text/javascript">
AC_FL_RunContent( 'codebase','https://fpdownload.macromedia.com/pub/
shockwave/cabs/flash/
swflash.cab#version=8,0,0,0','id','TaskShell','width','815','height','750','align','middle','src','<
%= mediaServerRoot %>flash/
TaskShell','quality','high','bgcolor','#ffffff','swliveconnect','true','name','TaskShell','allowscriptaccess','always','pluginspage','https://
www.macromedia.com/go/getflashplayer','movie','<%= mediaServerRoot
%>flash/TaskShell' ); //end AC code
</script><noscript><object classid="clsid:d27cdb6e-
ae6d-11cf-96b8-444553540000" codebase="https://
fpdownload.macromedia.com/pub/shockwave/cabs/flash/
swflash.cab#version=8,0,0,0" id="TaskShell" width="815" height="750"
align="middle">
<param name="allowScriptAccess" value="always" />
<param name="movie" value="<%= mediaServerRoot %>flash/
TaskShell.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="<%= mediaServerRoot %>flash/TaskShell.swf"
quality="high" bgcolor="#eae8e3" width="815" height="750"
swLiveConnect=true id="TaskShell" name="TaskShell" align="middle"
allowScriptAccess="always" type="application/x-shockwave-flash"
pluginspage="https://www.macromedia.com/go/getflashplayer" />
</object></noscript>


Error thrown
Value undefined (result of expression flash.initShell) is not object.
localhost:8080/task_page.jsp?sourceurl=modules/amodule/Task01_module/
module_01content.xml&suspended=false&moduleNum=10 (line 74)

Thanks for the help

Tim
 
R

RobG

Here is some more information on the issue I am seeing if this helps.

I don't think it has anything to do with the issue.

And maybe for those unnamed who believe this to all be a farse.

Built-in functions are not objects

Better to make quotes look like quotes, it appears as if you wrote
that.
Permalink | Safari | 1 comments
Reported on 17 August 2007

Built-in functions in Safari are not Function objects, and not even
Object objects. They appear to be of type "function" instead of type
"object". This makes it impossible to use .call() and .apply() on
them.

(ppknote: Safari 3 gives window.alert instanceof Object: true. 1.3
doesn't, though.)

Test page Workaround is not included
Reported by: Mihail Milushev.

This can be found athttp://www.quirksmode.org/bugreports/archives/safari/index.html

The poster of that is confused: in regard to javascript, the term
"built-in" refers to features that are specified in ECMA-262. As far
as I'm aware, all built-in functions in Safari conform to the
specification, e.g.

alert(typeof [].push); // function


What the poster is actually testing is window.alert, which is a host
object. Therefore all bets are off, they are not required by ECMA-262
to have the same behaviour as built-in and native objects and
functions.

The confusion may stem from the fact that both Firefox and Safari (3
at least) make most of their host objects very similar to native
objects, e.g.

alert( typeof document.getElementById );

shows function in Firefox and Safari, but object in IE.


alert( typeof document.getElementById.apply );

shows function in Firefox and Safari, but undefined in IE. I don't
see how this is related to the OP.
 
G

GinnTech

Here is the fix and the issue.

While I was trying to debug this issue I was using the apple provided
"Execute a Script". Essentially just trying to throw things at this
to get results I was wanting. The Prototype framework was the fix.
This 'function' issue was rearing it's head because of how safari
renders the page (for supposedly performance). In safari the actual
page load event is not truly done once the page is fully loaded. I
will say at least in this case concerning Flash. The .jsp page in
this case yes may be loaded, but the swf had not been completely
loaded when the script was being executed. So when the script tried
to access the swf's exposed functions they were not available
immediately. resulting in the return of a 'function' and not an
'object'. I discovered this by executing

$('TaskShell').initShell(API_1484_11.GetValue("cmi.launch_data")
+"&"+"<%=data %>");

after the page had been loaded a couple seconds and to all amazement
the content loaded in the swf. The fix if you want to call it that is
to check the flash object to see if it is being returned with a type
of 'function'. If so I am pausing the execution of the script by 3
seconds to allow for the swf to completely download and be available
to the browser. Now all is good.

Well I hope we all learned something and maybe this can help someone
in the future. I know I now know more than I ever wanted to know about
a browser less than 2% of the world uses.

Thanks for all the help.

Tim
 
R

RobG

Here is the fix and the issue.

While I was trying to debug this issue I was using the apple provided
"Execute a Script".  Essentially just trying to throw things at this
to get results I was wanting.  The Prototype framework was the fix.

What part of Prototype.js is "the fix"?

This 'function' issue was rearing it's head because of how safari
renders the page (for supposedly performance).  In safari the actual
page load event is not truly done once the page is fully loaded.

There is no *guarantee* that all content has been loaded when the load
event fires in any browser. Not loading a dependent resource will not
stop the load event from occurring provided the resource that loads it
is available.

 I
will say at least in this case concerning Flash.  The .jsp page in
this case yes may be loaded, but the swf had not been completely
loaded when the script was being executed.  So when the script tried
to access the swf's exposed functions they were not available
immediately.  resulting in the return of a 'function' and not an
'object'.  I discovered this by executing

$('TaskShell').initShell(API_1484_11.GetValue("cmi.launch_data")
+"&"+"<%=data %>");

after the page had been loaded a couple seconds and to all amazement
the content loaded in the swf.  The fix if you want to call it that is
to check the flash object to see if it is being returned with a type
of 'function'.  If so I am pausing the execution of the script by 3
seconds to allow for the swf to completely download and be available
to the browser.  Now all is good.

That strategy is called polling, it is not considered a good strategy
but if it's the only solution then use it. You might want to poll a
bit more frequently than every 3 seconds - say 200ms or so, depending
on what else is happening in the page. You should also cancel polling
after a reasonable number of attempts, the Flash object may not ever
load.

Well I hope we all learned something and maybe this can help someone
in the future. I know I now know more than I ever wanted to know about
a browser less than 2% of the world uses.

It isn't necessarily about a particular browser, but allowing for a
behaviour that is known to occur.
 

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
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top