HTTP请求和歌剧8 [英] HTTP Request and opera 8

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

问题描述



这个[1]脚本不适用于上一个Opera 8,但它与Internet的工作

资源管理器和Firefox,HTTP请求在Opera上运行不正常?


[1]

函数sendmessage(url,querystrings)

{

xmlhttp = checkxml();

if(xmlhttp)

{

xmlhttp.open(" POST",url,true); //方法和URL目的地

try {xmlhttp.setRequestHeader(" Content-type",

" application / x-www-form-urlencoded; charset = UTF -8 QUOT); } catch(e){} // Header


xmlhttp.onreadystatechange = function()//检查

请求状态的新函数

{

if(xmlhttp.readyState == 4)

{

if(xmlhttp.status == 200)

{

replymsg(''replymsg'',true);

document.getElementById(''message'')。value ='' '';

if(xmlhttp.responseText == 1)

{

alert(" [{Your_message_was_sended}]");

}

}

if(xmlhttp.status == 404)alert(" [{Ops!_404_Not_Found}]");

}

}


xmlhttp.send(querystrings); //用querystrings传递请求

}

}


-

马科斯。
http://www.linuxhard.org

解决方案




Marcos写道:

这[1]脚本没有与上一部Opera 8合作,但它与互联网资源管理器和Firefox的工作,HTTP请求在Opera上运行不正常?


不幸的是,Opera现在已经发布了Opera 8.00,其中包含XMLHttpRequest的实现
,它缺少一些属性和方法。

MSXML (由IE使用)和Mozilla中的XMLHttpRequest实现。他们的

关于XMLHttpRequest的整个工程似乎已经被实现了GMail使用的属性和方法的目标驱动了



似乎实现的属性和方法是


readyState

responseText

responseXML

status

open

发送

abort

getAllResponseHeaders

getResponseHeader


try {xmlhttp.setRequestHeader(" Content-type",
" application / x-www-form-urlencoded; charset = UTF-8"); } catch(e){} // Header




setRequestHeader未在Opera 8.00中实现,因此您无法通知

服务器有关内容您使用

发送方法发布的数据类型。


-


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


Martin Honnen写道:

try {xmlhttp.setRequestHeader(" Content-type",
" application / x -www窗体-urlencoded;字符集= UTF-8英寸); } catch(e){} //
标题


setRequestHeader未在Opera 8.00中实现,因此您无法通知服务器您正在发布的数据的内容类型<发送方法。




换句话说,Opera再次落后。


因为人很少无论如何都要使用Opera(为什么不使用Firefox?)我

甚至不关心支持它的怪癖和其他浏览器具有的随机实现

功能。如果人们选择使用缺乏其他人的能力的浏览器,而其他人可以免费使用他们的b $ b使用,那么IMO那些用户正在_choosing_有一个较小的网页浏览

体验,可能有错误和无法正常运行的脚本。


IE很容易说出来,但实际情况是IE是仍然是占主导地位的浏览器,所以它不像Opera那么容易被忽视;)


-

Matt Kruse
http://www.JavascriptToolbox.com





Matt Kruse写道:

Martin Honnen写道:

try {xmlhttp.setRequestHeader(" Content-type",
" application / x-www-form-urlencoded; charset = UTF-8"); } catch(e){} //
标题



setRequestHeader未在Opera 8.00中实现,因此您无法通知服务器有关数据的内容类型你用发送方法发布了



换句话说,Opera再次落后。




我很遗憾Opera并不关心在8.00的最终版本中提供兼容的

XMLHttpRequest实现,尽管

他们已经在那些7.60中部分实现了预览和8.00

测试版发布。

正如我已经说过,他们唯一的目标是XMLHttpRequest,这似乎是因为GMail可以与Opera合作8.


但你不能说他们一般都落后于Opera的功能

8,他们有SVG微支持(可缩放矢量图形),它们是

第一个具有DOM Level 3加载和保存的浏览器(只有没有多少

给出y如果Mozilla无法使用

XMLHttpRequest / DOMParser / XMLSerializer),它们具有DOM Level 2范围和

树步行者/遍历支持。
< br $> b $ b -

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



This [1]script not work with last Opera 8, but its work with Internet
Explorer and Firefox, the HTTP Request yet not work fine on the Opera?

[1]
function sendmessage(url, querystrings)
{
xmlhttp = checkxml();
if(xmlhttp)
{
xmlhttp.open("POST", url ,true); // Method and URL destination
try {xmlhttp.setRequestHeader("Content-type",
"application/x-www-form-urlencoded;charset=UTF-8"); } catch(e) {} // Header

xmlhttp.onreadystatechange=function() // New function that check the
state of request
{
if(xmlhttp.readyState==4)
{
if(xmlhttp.status==200)
{
replymsg(''replymsg'', true);
document.getElementById(''message'').value = '''';
if (xmlhttp.responseText==1)
{
alert("[{Your_message_was_sended}]");
}
}
if(xmlhttp.status==404) alert("[{Ops!_404_Not_Found}]");
}
}

xmlhttp.send(querystrings); // Transmits the request with querystrings
}
}

--
Marcos.
http://www.linuxhard.org

解决方案



Marcos wrote:

This [1]script not work with last Opera 8, but its work with Internet
Explorer and Firefox, the HTTP Request yet not work fine on the Opera?
Unfortunately Opera has now released Opera 8.00 with an implementation
of XMLHttpRequest which lacks some of the properties and methods that
MSXML (used by IE) and that XMLHttpRequest in Mozilla implement. Their
whole engineering in regard to XMLHttpRequest seems to have been driven
by the goal of implementing the properties and methods GMail uses.
It seems the implemented properties and methods are

readyState
responseText
responseXML
status
open
send
abort
getAllResponseHeaders
getResponseHeader

try {xmlhttp.setRequestHeader("Content-type",
"application/x-www-form-urlencoded;charset=UTF-8"); } catch(e) {} // Header



setRequestHeader is not implemented in Opera 8.00 thus you cannot inform
the server about the content type of the data you are POSTing with the
send method.

--

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


Martin Honnen wrote:

try {xmlhttp.setRequestHeader("Content-type",
"application/x-www-form-urlencoded;charset=UTF-8"); } catch(e) {} //
Header


setRequestHeader is not implemented in Opera 8.00 thus you cannot
inform the server about the content type of the data you are POSTing
with the send method.



In other words, Opera lags behind once again.

Since very few people use Opera anyway (why not use Firefox instead?) I
don''t even care about supporting its quirks and random implementations of
features other browsers have. If people choose to use a browser that lacks
the capabilities of others, and the others are freely available for them to
use, then IMO those users are _choosing_ to have a lesser web browsing
experience, possibly with errors and non-functioning scripts.

The same could easily be said for IE, but the reality is that IE is still
the dominant browser, so it''s not as easy to ignore as Opera is ;)

--
Matt Kruse
http://www.JavascriptToolbox.com




Matt Kruse wrote:

Martin Honnen wrote:

try {xmlhttp.setRequestHeader("Content-type",
"application/x-www-form-urlencoded;charset=UTF-8"); } catch(e) {} //
Header



setRequestHeader is not implemented in Opera 8.00 thus you cannot
inform the server about the content type of the data you are POSTing
with the send method.


In other words, Opera lags behind once again.



I am disappointed myself that Opera didn''t care to provide a compatible
implementation of XMLHttpRequest in the final release of 8.00 although
they already had a partial implementation in those 7.60 preview and 8.00
beta releases.
As I have already said their only goal for XMLHttpRequest os far seems
to be that GMail works with Opera 8.

But you cannot say that they generally lag behind with features in Opera
8, they have SVG tiny support (scalable vector graphics), they are the
first browser to have DOM Level 3 Load and Save (only there is not much
that gives you that Mozilla couldn''t do with
XMLHttpRequest/DOMParser/XMLSerializer), they have DOM Level 2 range and
tree walker/traversal support.

--

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


这篇关于HTTP请求和歌剧8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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