Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

Firefox on iOs is detected as Safari #88

Open
@janmech

Description

@janmech

When checking for firefox the first criteria to is the absence of 'safari' in the user agent string.

but on iOS 'safari' appears (@see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent/Firefox)

Instead of 'Firefox/version' 'FxiOS/version' is used.

Hence firefox on iOS is identified as Safari with version:unkown.

IN:

Sinergi\BrowserDetector\BrowserDetector

public static function checkBrowserFirefox()
    {
        if (stripos(self::$userAgentString, 'safari') === false) {
            if (preg_match("/Firefox[\/ \(]([^ ;\)]+)/i", self::$userAgentString, $matches)) {
                if (isset($matches[1])) {
                    self::$browser->setVersion($matches[1]);
                }
                self::$browser->setName(Browser::FIREFOX);

                return true;
            } elseif (preg_match('/Firefox$/i', self::$userAgentString, $matches)) {
                self::$browser->setVersion('');
                self::$browser->setName(Browser::FIREFOX);

                return true;
            }
        }

        return false;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions