Thursday 31 August 2023

Why javascript/jquery code does not work on n android devices?

On laravel 8.83 / jquery 3.6.0 app when user clicked on action button and ajax response returned new value is set (groupedNewsUserActionsCount of response) into div with id = "#total_actions_" + newsId + "_" + action + "_label" and to assign class 'news-user-reactions-item-voted' into block

I do it with a code :

$.ajax({
    type: "POST",
    dataType: "json",
    url: "/news/react",
    data: {"_token": "", "newsId": newsId, "action": action},
    success: function (response) {

        $("#total_actions_" + newsId + "_" + action + "_label").html(response.groupedNewsUserActionsCount === 0 ? '' : response.groupedNewsUserActionsCount)

        // Make _cancel action button visible and hide add action button
        $("#a_" + newsId + "_" + action + "_add_action").css('display', 'none')

        $("#a_" + newsId + "_" + action + "_cancel_action").css('display', 'block')

        // User voted this action : show icon image in light blue color
        $("#div_" + newsId + "_" + action + "_add_action_block").attr('class', 'news-user-reactions-item-voted')
    },
    error: function (error) {
        console.log(error)
    }
});

That works ok on common browsers, but does not work properly(new value is not set and class is not changed) on android devices. Do I use some invalid methods which are not valid for android devices ? Which methods have I to use ?

EDIT :

I make test with Samsung Galaxy A 50 and when my page is opened in chrome browser I found option/checkbox "Version for comp" - if to turn it on the the page is reopeened at first - and after that all functionality with new value applied and class changed new class changed WORKS properly! What option is it and how I use it in my issue ?

EDIT # 2:

I have reinstalled google-chrome-stable and now I have in my system:

 dpkg -s     google-chrome-stable
Package: google-chrome-stable
Status: install ok installed
Priority: optional
Section: web
Installed-Size: 320121
Maintainer: Chrome Linux Team <chromium-dev@chromium.org>
Architecture: amd64
Version: 116.0.5845.140-1
Provides: www-browser
Depends: ca-certificates, fonts-liberation, libasound2 (>= 1.0.17), libatk-bridge2.0-0 (>= 2.5.3), libatk1.0-0 (>= 2.2.0), libatspi2.0-0 (>= 2.9.90), libc6 (>= 2.17), libcairo2 (>= 1.6.0), libcups2 (>= 1.6.0), libcurl3-gnutls | libcurl3-nss | libcurl4 | libcurl3, libdbus-1-3 (>= 1.9.14), libdrm2 (>= 2.4.75), libexpat1 (>= 2.0.1), libgbm1 (>= 17.1.0~rc2), libglib2.0-0 (>= 2.39.4), libgtk-3-0 (>= 3.9.10) | libgtk-4-1, libnspr4 (>= 2:4.9-2~), libnss3 (>= 2:3.35), libpango-1.0-0 (>= 1.14.0), libu2f-udev, libvulkan1, libx11-6 (>= 2:1.4.99.1), libxcb1 (>= 1.9.2), libxcomposite1 (>= 1:0.4.4-1), libxdamage1 (>= 1:1.1), libxext6, libxfixes3, libxkbcommon0 (>= 0.5.0), libxrandr2, wget, xdg-utils (>= 1.0.2)
Pre-Depends: dpkg (>= 1.14.0)
Description: The web browser from Google
 Google Chrome is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier.

But anyway In chrome://inspect/#devices I got message :

⚠ Remote browser is newer than client browser. Try `inspect fallback` if inspection fails.

Sure I have started new session in chrome and restarted my OS. Are there some cache I need to clear or restart some service?

What is “inspect fallback” in mentioned in error message ?

On my Samsung Galaxy A 50 I see version 116.05845.114 They have very close version numbers “116.05845”... What is wrong ?



from Why javascript/jquery code does not work on n android devices?

No comments:

Post a Comment