Giter Site home page Giter Site logo

craft-plugin-agent's People

Contributors

angrybrad avatar marknotton avatar marknotton-yello avatar zizther avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

craft-plugin-agent's Issues

'set criteria' not working anymore after update to agent version 4

Hi, i used the redirect with the criteria method.
it all worked fine until i updated to version 4 of the plugin.

Thats what i am using:

{% set criteria = [
  'chrome > 55',
  'firefox > 44',
  'safari >= 7',
  'edge >= 15',
  'opera > 50'
] %}

{{ craft.agent.redirect(criteria, 'no-support.twig', 302) }}

Does this version only work with craft 4, as i am running craft 3.7.53.1?

If it should also work with craft 3, did something changed with the criteria method?
The docs don't show any difference, but maybe i missed something?

Ipad pro does not count as a tablet

Ipad pro does not count as a tablet for some reason.

I've been testing on a ipad pro 12.9 2020.

Any ideas how I can get it to show ipad pros as a tablet? Or is there a way to target all touch devices?

Missing marknotton/agent repository

I can't run composer install or update anymore because of the missing marknotton/agent repository. Please can you fix this?

[RuntimeException]
  Could not load package marknotton/agent in http://repo.packagist.org: [UnexpectedValueExce
  ption] Could not parse version constraint ^3.0.0.*: Invalid version string "^3.0.0.*"

This was working as expected previously, using the "marknotton/agent": "1.1.8" version.

Google page crawler problems

Good Morning

We use your plugin to detect if a user visits our page with the Internet Explorer Browser.
To check this we do following Check:

{% if craft.agent.check('ie') and not craft.agent.isRobot() %}
{% include '_partials/not-supported.twig' %}
{% else %}
{% include '_partials/navigation.twig' %}
{% block body %}
{% endblock %}
{% include '_partials/footer.twig' %}
{% endif %}

This works fine for the Internet Explorer detection, but the Google Page Crawler get's into this If clause too. So the page is not indexed by Google.

How can we fix this problem?
Please let me know if you need further details.

Kind regard

Installation/update error

When updating Craft or installing the plugin, I get the following error:

Error: Could not load package marknotton/agent in https://composer.craftcms.com: [UnexpectedValueException] Could not parse version constraint ^3.0.0.*: Invalid version string "^3.0.0.*"

floor(): Argument #1 ($num) must be of type int|float, string given

Getting this on "craftcms/cms": "^3.6.0", PHP 7.4.16

TypeError: floor(): Argument #1 ($num) must be of type int|float, string given in /vendor/marknotton/agent/src/services/Services.php:244
Stack trace:
#0 /vendor/marknotton/agent/src/services/Services.php(244): floor('89.0.4389.82')
...

Its this line:

$this->version = floor($this->agent->version($this->agent->browser()));

When user agent is blank, the check method returns "true"

When we use

{{craft.agent.check('ie <= 11')}}

And the user agent is not supplied, e.g.

curl --user-agent "" https://example.com/

it will return true when it is supposed to return false.

However, using a magic method like isIE() works

Please let me know if you need further detail.

Craft 4 support?

It looks like this plugin is not ready for Craft 4. Is an update planned to support it?

Screen Shot 2022-05-09 at 11 09 56 AM

How to detect in-app instragram browser

Right now i am using these criterias for redirecting old ie 11 Browser to the unsupported page.
At least this is how i understand it to work. My Goal is to show users of IE 11 the unsupported message.
Or is there a better way?

{% set criteria = [
'chrome >= 1',
'firefox >= 1',
'safari >= 1',
'edge >= 1',
'opera >= 1'
] %}

{{ craft.agent.redirect(criteria, 'pages/errors/not-supported', 302) }}

But with this implementation, the unsupported message gets also shown, if i user get to the page via
instagram and there in-app browser.

What would be the best solution to include instagram?

thanks.

Match negative criteria for redirects

Sorry if I missed this somewhere, but is it possible to use the redirect but checked against negative criteria? Right now, it seems like the criteria matches can only be positive. I was hoping to redirect ONLY Internet Explorer to a separate page.

For example, currently, the following only allows Firefox to bypass this no-support page redirect:

{% set criteria = [ 'firefox' ] %} {# only Firefox is redirected #}
{{ craft.agent.redirect(criteria, 'no-support', 302) }}

It would make more sense to me to have the included criteria be what triggers the redirect:

{% set criteria = [ 'not ie' ] %} {# every browser BUT ie would proceed without redirecting #}
{{ craft.agent.redirect(criteria, 'no-support', 302) }}

Thanks for the plugin and any help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.