Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide in Safari browser #74

Closed
saurabhSiddhu opened this issue Jan 4, 2018 · 8 comments
Closed

Hide in Safari browser #74

saurabhSiddhu opened this issue Jan 4, 2018 · 8 comments

Comments

@saurabhSiddhu
Copy link

Is it possible to hide smartbanner only in safari browser ?

@ain
Copy link
Owner

ain commented Jan 4, 2018

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.*">

@ain ain closed this as completed Jan 4, 2018
@RoySegall
Copy link

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

@ain
Copy link
Owner

ain commented Jan 10, 2018

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

@RoySegall
Copy link

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?

@ain
Copy link
Owner

ain commented Jan 10, 2018

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

@RoySegall
Copy link

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.

@ranihorev
Copy link

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">

@DevMo99
Copy link

DevMo99 commented Apr 7, 2020

You can use this exclusion

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants