Mediawiki + AJAX + IE = broken

[亡魂溺海] 提交于 2019-12-11 08:26:29

问题


I have created an extension for mediawiki that works in all major browsers other than IE (any version it appears). The extension relies on mediawiki's ajax wrapper to send an xmlhttprequest with parameters that essentially build a database query to a php script. This script will run a query based on the parameters and then create an XML object (using php's simplexml class) which then returns the XML to javascript for display in the browser (just a table, mostly).

Now with all that information, IE seems to be working up until the point at which it tries to parse the returned XML. I have set the mime type to application/xml and I have tried loading it with various different techniques found via google (none worked).

It is trivial to load the XML for parsing when using non-IE browsers:

function callbackHCL(response){
    if (response.readyState == 4) {
        var xmlObj = response.responseXML;
            if (response.status == '200'){
                if (xmlObj !== undefined){
                    //etc...

Now I can start using dom functions to get at data.

My Question: Does anybody have any suggestions on how to parse xml in IE based on my current scenario?

If you would like to email me at tccroninv@gmail.com, I can provide longer code snippets, they are longer and I don't believe they would help the situation. If you would like me to post more code, just ask as well.

Thanks in advance, Tim


回答1:


I think this might be what you want: http://dean.edwards.name/weblog/2006/04/easy-xml/. Basically, IE doesn't return an XML document like the other guys. Need to do a little fancy footwork to make it work correctly. I'm sure there's a library out there that wraps this all up so you don't have to worry about it if you don't want to.



来源:https://stackoverflow.com/questions/1904443/mediawiki-ajax-ie-broken

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!