Safari问题 [英] Safari Issue

查看:70
本文介绍了Safari问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在IE6 IE7 FF2 FF3中完美运行但不在

最新Safari中的网站。


这是问题所在。我试图在闪存中调用函数

对象。当试图检索对象来调用

函数IE6 IE7 FF2 FF3时都返回要使用的对象。在Safari

中返回一个函数。这是代码。

展开 | 选择 | Wrap | 行号

解决方案

GinnTech写道:
< blockquote class =post_quotes>
我有一个在IE6 IE7 FF2 FF3中完美运行但不在

最新Safari中的网站。


这是问题所在。我试图在闪存中调用函数

对象。当试图检索对象来调用

函数IE6 IE7 FF2 FF3时都返回要使用的对象。在Safari

中返回一个函数。这是代码。


[code]



这是Usenet。不要打扰(我们)伪标签。


[...]

//局部变量定义



当这些变量定义实际上是* global *

变量*声明*?


var apiHandle = null;

var API = null;



永远不会读取此变量。


var findAPITries = 0;

[...]

函数initAPI()

{

var api = getAPIHandle();



在此处声明并初始化名为api的局部变量。


if(api = = null)

{

alert(无法找到RTE的API实现);

return" false" ;

}

其他

{



因为此分支继续执行,getAPIHandle()将在类型转换后返回一个

值,该值不等于null。


api.setActivityID(document .forms [0] .activityID.value);



由于调用方法时发生错误,getAPIHandle()将返回一个

值,该值不是对象引用(但不是

类型转换后等于'null''或者引用的对象没有这样的方法。


[... ]

}

}


[...]

函数getAPIHandle()

{

if(apiHandle == null)

{

apiHandle = getAPI();

}

返回apiHandle;

}


[...]

功能findAPI(win)

{


while((win.API_1484_11 == null)&&(win.parent!= null)&& ;

(win.parent!= win))

{

findAPITries ++;

//注意:500是一个基于IEEE API标准的数字。

if(findAPITries 500)

{

alert(& 发现API时出错 - 嵌套太深了。;)

返回null;

}


win = win .parent;


}

// ToDo:从这里开始调试如何让Safari看到这个对象。



^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^


返回win.API_1484_11;

}



因为一切都归结为这个方法,首先会发现导致错误

的问题在那里。但ISTM的调试需要在它之上启动。


[...]

功能getAPI()

{

var theAPI = findAPI(window);

if((theAPI == null)&&(window .opener!= null)&&

(typeof(window.opener)!=" undefined"))

{

theAPI = findAPI(window.opener);

}

if(theAPI == null)

{

alert(RTE - 找不到API适配器);

}

返回API

}


[...]

代码错误

api.setActivityID(document.forms [0] .activityID.value);


with

值undefined(表达式api.setActivityID的结果)不是

对象。


低,看它不是一个对象,它是

safari眼中的功能。



完全无稽之谈。 Safari非常明确地说,

api.setActivityID的结果,即'undefined''值不是

对象(因此也没有Function对象)。


有没有人知道在safari中解决这个问题。



if(api)


而不是


if(api = = null)


可能足以避免运行时错误。


尽管如此,代码仍会有其他一些问题。

PointedEars

-

Prototype.js是由那些不懂javascript for people

who don'的人写的不懂javascript。不知道javascript的人不是设计使用javascript的系统的最佳建议来源。

- Richard Cornford,cljs,< f8 ** *****************@news.demon.co.uk>


GinnTech写道:


我有一个在IE6 IE7 FF2 FF3中完美运行但不在

最新Safari中的网站。


这里是问题。我试图在闪存中调用函数

对象。当试图检索对象来调用

函数IE6 IE7 FF2 FF3时都返回要使用的对象。在Safari

中返回一个函数。这是代码。

展开 | 选择 | Wrap | 行号


8月10日,1:19 * am,RobG< rg ... @ iinet.net.auwrote:


GinnTech写道:


我有一个网站在IE6 IE7 FF2 FF3中完美运行,但在最近的
最新的Safari中没有。


这是问题所在。 *我试图在闪存中调用函数

对象。 *当试图检索对象以调用

函数IE6 IE7 FF2 FF3时都返回要使用的对象。 *在Safari

中返回一个函数。 *这是代码。

展开 | 选择 | Wrap | 行号


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.

Expand|Select|Wrap|Line Numbers

解决方案

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.

Expand|Select|Wrap|Line Numbers


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.

Expand|Select|Wrap|Line Numbers


这篇关于Safari问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆