Javascript-форум (https://javascript.ru/forum/)
-   Firefox/Mozilla (https://javascript.ru/forum/css-html-firefox-mizilla/)
-   -   if ($.browser.mozilla) (https://javascript.ru/forum/css-html-firefox-mizilla/48903-if-%24-browser-mozilla.html)

Xant1k 21.07.2014 15:12

if ($.browser.mozilla)
 
Проблемный кусок
if ($.browser.mozilla) {
        getstr = "?t=" + movie_imdb + "&y=" + year;
        GM_xmlhttpRequest({
            method: "GET",
            url: "http://www.omdbapi.com/" + getstr,
            onload: function (response) {
                var data = eval("(" + response.responseText + ")");
                $("#loading").detach();
                $(".torrents").append('<a style="margin: 14px;" target="_blank" title="IMDB" href="http://www.imdb.com/title/' + data.imdbID + '"><img style="border:0; margin-top: 3px; margin-bottom : 3px; width: 16px; height: 16px;"  src="' + imdb_img + '"></a>')
            }
        })
    } else {
        $.ajax({
            url: "http://www.omdbapi.com/",
            data: "t=" + movie_imdb + "&y=" + year,
            jsonp: "callback",
            jsonpCallback: "callbackName",
            dataType: "jsonp",
            timeout: 180000
        }).done(function callbackName(data) {
            if (data.Response == "True") {
                $("#loading").detach();
                $(".torrents").append('<a style="margin: 14px;" target="_blank" title="IMDB" href="http://www.imdb.com/title/' + data.imdbID + '"><img style="border:0; margin-top: 3px; margin-bottom : 3px; width: 16px; height: 16px;"  src="' + imdb_img + '"></a>')
            } else {
                $("#loading").detach();
                $(".torrents").append('<a style="margin: 14px;" target="_blank" title="IMDB" href="http://www.imdb.com/find?q=' + movie_enc + '"><img style="border:0; margin-top: 3px; margin-bottom : 3px; width: 16px; height: 16px;"  src="' + imdb_img + '"></a>')
            }
        }).fail(function (jqXHR, data) {
            $("#loading").detach();
            $(".torrents").append('<a style="margin: 14px;" target="_blank" title="IMDB" href="http://www.imdb.com/find?q=' + movie_enc + '"><img style="border:0; margin-top: 3px; margin-bottom : 3px; width: 16px; height: 16px;"  src="' + imdb_img + '"></a>')
        })
    }

В хроме всё ок. Почему в фф не работает?

Aetae 21.07.2014 16:09

Попробуйте убоать кусок if ($.browser.mozilla) и делать в ff тоже самое что и в chrome. Может оно и работать тогда будет также?..

Xant1k 21.07.2014 16:32

Вложений: 1
Удаление этого куска или комментирование не помогает.
Прикладываю сам скрипт

Aetae 21.07.2014 17:06

http://learn.javascript.ru/play/pWTp5b
всё работает.

Sweet 21.07.2014 17:07

Xant1k, jQuery.browser - давно устарело (с версии 1.3). А начиная с версии 1.9 - вообще выпелено. Так что лучше забудь про это api.

Xant1k 21.07.2014 19:47

Aetae,
Ок.


Часовой пояс GMT +3, время: 07:46.