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. -
/
-
*******************************************************************************
-
**
-
** 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 15 2622
GinnTech wrote:
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]
This is Usenet. Do not bother (us) with pseudo-tags.
[...]
// local variable definitions
How can these be local variable definitions when they are in fact *global*
variable *declarations*?
var apiHandle = null;
var API = null;
This variable is never read.
var findAPITries = 0;
[...]
function initAPI()
{
var api = getAPIHandle();
A local variable named `api' is declared and initialized here.
if (api == null)
{
alert("Unable to locate the RTE's API Implementation");
return "false";
}
else
{
Since execution continues in this branch, getAPIHandle() would return a
value that is not equal to `null' after type conversion.
api.setActivityID( document.forms[0].activityID.value );
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.
[...]
}
}
[...]
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;
}
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.
[...]
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.
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).
Does anyone know a work around for this in safari.
if (api)
instead of
if (api == null)
might suffice to avoid the runtime error.
Nevertheless, the code would still have several other issues.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>
GinnTech wrote:
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.
-
/
-
*******************************************************************************
-
-
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.
-
-
[...]
-
-
/
-
*******************************************************************************
-
** 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
-
-
-
They're global.
-
-
-
var apiHandle = null;
-
var API = null;
-
-
-
Unused variable
-
-
-
var findAPITries = 0;
-
/
-
**
-
**
-
** Function: doInit()
-
-
-
It's called doInit here...
-
-
-
** Inputs: none
-
** Return: false if the API handle cannot be located
-
**
-
** Description: gets the API handle and sets up necessary api variable
-
values
-
**
-
**
-
*******************************************************************************/
-
-
-
and initAPI here
-
-
-
function initAPI()
-
{
-
var api = getAPIHandle();
-
-
-
getAPIHandle() returns the result of a call to getAPI(), which in turn
-
calls findAPI(window). For me, api is set to undefined.
-
-
-
-
if (api == null)
-
-
-
It isn't null, it's undefined but the test returns true anyway. Consider:
-
-
if (typeof api != 'object');
-
-
-
{
-
alert("Unable to locate the RTE's API Implementation");
-
return "false";
-
-
-
Do you really mean to return the string 'false' or the boolean value 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
-
-
-
It seems it will return the result of win.API_1484_11, which is likely
-
to be undefined, not null.
-
-
-
**
-
** 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))
-
-
-
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.
-
-
-
-
{
-
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;
-
-
-
That returns undefined for me, not null as specified in the documentation.
-
-
-
}
-
/
-
*******************************************************************************
-
**
-
** 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.
--
Rob
On Aug 10, 1:19*am, RobG <rg...@iinet.net.auwrote:
GinnTech wrote:
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.
-
/
-
*******************************************************************************
-
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.
-
[...]
-
-
/
-
*******************************************************************************
-
** 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
-
-
-
-
They're global.
-
-
var apiHandle = null;
-
var API = null;
-
-
-
-
Unused variable
-
-
var findAPITries = 0;
-
-
-
-
-
/
-
**
-
**
-
** Function: doInit()
-
-
-
-
It's called doInit here...
-
-
** Inputs: *none
-
** Return: *false if the API handle cannot be located
-
**
-
** Description: gets the API handle and sets up necessary api variable
-
values
-
**
-
**
-
*******************************************************************************/
-
-
-
-
and initAPI here
-
-
function initAPI()
-
{
-
* *var api = getAPIHandle();
-
-
-
-
getAPIHandle() returns the result of a call to getAPI(), which in turn
-
calls findAPI(window). *For me, api is set to undefined.
-
-
* *if (api == null)
-
-
-
-
It isn't null, it's undefined but the test returns true anyway. *Consider:
-
* * *if (typeof api != 'object');
-
-
* *{
-
* * * alert("Unable to locate the RTE's API Implementation");
-
* * * return "false";
-
-
-
-
Do you really mean to return the string 'false' or the boolean value 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
-
-
-
-
It seems it will return the result of win.API_1484_11, which is likely
-
to be undefined, not null.
-
-
**
-
** 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))
-
-
-
-
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.
-
-
* *{
-
* * * 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;
-
-
-
-
That returns undefined for me, not null as specified in the documentation..
-
-
}
-
-
-
-
-
/
-
*******************************************************************************
-
**
-
** 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.
--
Rob
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
On Aug 10, 1:19*am, RobG <rg...@iinet.net.auwrote:
GinnTech wrote:
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.
-
/
-
*******************************************************************************
-
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.
-
[...]
-
-
/
-
*******************************************************************************
-
** 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
-
-
-
-
They're global.
-
-
var apiHandle = null;
-
var API = null;
-
-
-
-
Unused variable
-
-
var findAPITries = 0;
-
-
-
-
-
/
-
**
-
**
-
** Function: doInit()
-
-
-
-
It's called doInit here...
-
-
** Inputs: *none
-
** Return: *false if the API handle cannot be located
-
**
-
** Description: gets the API handle and sets up necessary api variable
-
values
-
**
-
**
-
*******************************************************************************/
-
-
-
-
and initAPI here
-
-
function initAPI()
-
{
-
* *var api = getAPIHandle();
-
-
-
-
getAPIHandle() returns the result of a call to getAPI(), which in turn
-
calls findAPI(window). *For me, api is set to undefined.
-
-
* *if (api == null)
-
-
-
-
It isn't null, it's undefined but the test returns true anyway. *Consider:
-
* * *if (typeof api != 'object');
-
-
* *{
-
* * * alert("Unable to locate the RTE's API Implementation");
-
* * * return "false";
-
-
-
-
Do you really mean to return the string 'false' or the boolean value 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
-
-
-
-
It seems it will return the result of win.API_1484_11, which is likely
-
to be undefined, not null.
-
-
**
-
** 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))
-
-
-
-
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.
-
-
* *{
-
* * * 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;
-
-
-
-
That returns undefined for me, not null as specified in the documentation..
-
-
}
-
-
-
-
-
/
-
*******************************************************************************
-
**
-
** 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.
--
Rob
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
GinnTech wrote:
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
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
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.
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
On Aug 10, 7:27*pm, GinnTech <Tim.Dale.G...@gmail.comwrote:
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.
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.
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?
On Aug 10, 8:19*pm, David Mark <dmark.cins...@gmail.comwrote:
On Aug 10, 7:27*pm, GinnTech <Tim.Dale.G...@gmail.comwrote:
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.
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.
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?
On Aug 11, 12:32*am, GinnTech <Tim.Dale.G...@gmail.comwrote:
On Aug 10, 8:19*pm, David Mark <dmark.cins...@gmail.comwrote:
On Aug 10, 7:27*pm, GinnTech <Tim.Dale.G...@gmail.comwrote:
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.
Now your on point this is the exact problem with safari. *And yes Ido
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.
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.
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.
GinnTech wrote:
On Aug 10, 8:24 pm, RobG <rg...@iinet.net.auwrote:
>On Aug 11, 9:27 am, GinnTech <Tim.Dale.G...@gmail.comwrote:
Please trim quotes and do not remove attribution.
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
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
On Aug 11, 3:44 pm, GinnTech wrote:
<snip>
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.
On Aug 11, 11:20*am, Henry <rcornf...@raindrop.co.ukwrote:
On Aug 11, 3:44 pm, GinnTech wrote:
<snip>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.
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_d ata")+"&"+"<
%=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','wid th','815','height','750','align','middle','src','<
%= mediaServerRoot %>flash/
TaskShell','quality','high','bgcolor','#ffffff','s wliveconnect','true','name','TaskShell','allowscri ptaccess','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
On Aug 12, 12:44*am, GinnTech <Tim.Dale.G...@gmail.comwrote:
[...]
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.
--
Rob
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
On Aug 13, 3:01*am, GinnTech <Tim.Dale.G...@gmail.comwrote:
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.
--
Rob This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: DU |
last post by:
According to a recent post, it seems that Konqueror 3.1+ and Safari 1.1
support CSS3 opacity style property under a proprietary name:
"Support for the CSS3 opacity (using -khtml-opacity)...
|
by: sanj |
last post by:
Hi all,
My site is located at:
http://www.eastdayspa.com/index.html
I have use these main styles
/* main styles */
|
by: Nitronic |
last post by:
I got this javascript code below and each time i got to a safari browser
it thinks its netscpe any ideas. But i threw in Safari code but it doesn't
work.
var browserName=navigator.appName;
//...
|
by: Doug Lerner |
last post by:
I'm working on a client/server app that seems to work fine in OS Firefox and
Windows IE and Firefox.
However, in OS X Safari, although the UI/communications themselves work
fine, if the...
|
by: metoikos |
last post by:
I've scoured the web (clumsily, I'm sure) for information on the
difficulties I am having, checked my markup in validators, and had a
friend with more CSS clue look over it, but I haven't had any...
|
by: effendi |
last post by:
I wrote the following function and tested it in MSIE, Firefox and Mac
Safari, Works in all but the Safari. What can I do to rectify this?
function processBackground(){ for (n=1;n<11;n++)
{
...
|
by: Edward |
last post by:
Hi All,
I am having huge problems with a very simple dotnet framework web page
(www.gbab.net/ztest3.aspx) , it does NOT render correctly under Apple's
Safari. The DIV's do not align amd float as...
|
by: Liam |
last post by:
Hi all. New to the group and new to using Safari (for work).
I noticed while coding a module at work that the sort() works quite
differently in Safari than it does in FireFox and IE.
My issue...
|
by: David Stone |
last post by:
Run into something recently that has left me a little puzzled.
According to the examples in section 13.6.1 of html 4.01...
<http://www.w3.org/TR/html401/struct/objects.html#h-13.6.1.1>
I...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |