Code Monkey home page Code Monkey logo

Comments (8)

ranihorev avatar ranihorev commented on May 20, 2024 8

Hey,
You can hide the banner only on iOS Safari using the following exclusion:
<meta name="smartbanner:exclude-user-agent-regex" content="^.*iPhone(?!.*CriOS).*Safari">

from smartbanner.js.

ain avatar ain commented on May 20, 2024 1

Component comes without API and has only meta tag support currently.

You can use:

  1. enabled-platforms with android and without ios
  2. include-user-agent-regex with .*Android.*, see documentation

from smartbanner.js.

RoySegall avatar RoySegall commented on May 20, 2024 1

Never mind, I used something like this:

      var md = new MobileDetect(window.navigator.userAgent);

      if (md.userAgent() == 'Safari') {
        $('body').addClass('hide-smartapp-banner');
      }

And the css is

.hide-smartapp-banner .smartbanner {
  display: none !important;
}

Thanks a lot for this awesome plugin.

from smartbanner.js.

DevMo99 avatar DevMo99 commented on May 20, 2024 1

You can use this exclusion

name="smartbanner:exclude-user-agent-regex" content="^((?!Chrome|Android|FxiOS|CriOS).)*Safari"

from smartbanner.js.

ain avatar ain commented on May 20, 2024

Yes, it is. Please refer to Hide the smartbanner for certain User Agents.

In your case the following should do:

<meta name="smartbanner:exclude-user-agent-regex" content=".*Safari.*">

from smartbanner.js.

RoySegall avatar RoySegall commented on May 20, 2024

but this hides the bar for chrome on iPhone as well. Is there any way to programmatically set the banner as I want to?

from smartbanner.js.

ain avatar ain commented on May 20, 2024

iPhone also runs Safari. In that case you need to work out a regular expression that targets desktop exclusively.

from smartbanner.js.

RoySegall avatar RoySegall commented on May 20, 2024

the thing is - I need to show this on:
chrome - andoird and iphone
safari - not at all.

there is a legacy code in the project that can detect it but I need that the bar will be disabled by default and I could do something like:

smartbanner = new SmartBanner();
if (foo) {
  smartbanner.publish();
}

Is that possible?

from smartbanner.js.

Related Issues (20)

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.