Home>

I was a WEB designer who came only with html and CSS, but I am repairing the WEB application developed by Laravel.

I received a request to display the mobile version site when accessing from a device with iPad 13 or later.
In another application, the cookie is written out, and if there is a character string "mobile" in the cookie, it is judged as mobile.
In the Laravel app, it is specified to call mobile.php when it is judged as mobile, so I want to make it judge as mobile when accessing it with a terminal of iPad 13 or later, but I do not know how to do it.
I would appreciate it if you could teach me.

Addendum
I think it is implemented in a js file ...

heckDeviceType ({dispatch, commit, state}) {
        let ua= navigator.userAgent,
            isWindowsPhone= /(?:WindowsPhone)/.test(ua),
            isSymbian= /(?:SymbianOS)/.test(ua) || isWindowsPhone,
            isAndroid= /(?:Android)/.test(ua),
            isFireFox= /(?:Firefox) /.test(ua),
            isChrome= /(?: Chrome | CriOS) /.test (ua),
            isTablet= /(?: iPad | PlayBook) /.test (ua) || (isAndroid &
&
 ! /(?: Mobile) /. test (ua)) || (isFireFox &
&
 /(?:Tablet)/.test(ua),
            isPhone= /(?:iPhone)/.test(ua) &
&
 ! isTablet,
            isPc=! isPhone &
&
 ! isAndroid &
&
 ! isSymbian;
        let os= {
            isTablet: isTablet, isTablet,
            isPhone: isPhone,
            isAndroid: isAndroid,
            isPc: isPc
        }
        commit ("getDeviceType", os);
    },

Addendum:
Thank you very much. I found the toolbar as false for isTablet and true for other DeviceTypes only in the following sources. async created () {this.checkDeviceType (); this. $ Store.commit ('home /setUsingPublicHash', false); this. $ store.state.home.title=''; this.startVisibilityWatch (); a little more source code I will analyze it.

Addendum:
I tried adding it to isphone, but it didn't work. Is it written differently? Isn't this the case in the first place? isPhone= /(?:iPhone)/.test(ua) & & ! isTablet || (/android | ipod | ipad | iphone | macintosh /.test (ua) & & 'ontouchend' in document),

Addendum:
There was also a branch with ismobile.
It seemed that Mobile-Detect was also specified. PHP itself seems to link to the original GitHub URL.

Since the Laravel standard does not have a mobile judgment function, I guess that it is probably implemented in some way. Please add to the question how to judge the implementation part.

keitaro_so2021-10-13 04:38:34

I see, the judgment process is provided by a common function. I think that it is possible to judge iPad13 or later and set isPhone to true, but it is inconvenient to set isPhone to true for iPad13 or later unless you investigate how it is used by the callee of heckDeviceType other than that. There seems to be. It seems that you have to do your best to read the source code.

keitaro_so2021-10-13 04:38:34

Unfortunately, it seems that the range is wide rather than the level of questions that are asked one by one. It is already at the level of requesting repairs to the app. It is a level where you can make money by itself. I think that the only thing that can be said here is to correct the part that is being judged and the part that is using the judgment result.

keitaro_so2021-10-13 04:38:34