Skip to content

Instantly share code, notes, and snippets.

@SJ-James
Created December 11, 2017 17:47
Show Gist options
  • Save SJ-James/6b07a50e8466fd608bbe9b2281065601 to your computer and use it in GitHub Desktop.
Save SJ-James/6b07a50e8466fd608bbe9b2281065601 to your computer and use it in GitHub Desktop.
Facebook Browser Warning | Divi
<?php
if ( !function_exists( 'fb_browser_warning' ) ) {
function fb_browser_warning() {
?>
<style>
.fb_browser_warning {
position: relative;
background: #3B5998;
padding: 20px 20px 20px 80px;
color: #fff;
}
.fb_browser_warning:before {
position: absolute;
font-family: "etModules";
content: "\e093";
margin-left: -50px;
top: calc(50% - 10px);
font-size: 24px;
}
</style>
<script>
var ua = navigator.userAgent || navigator.vendor || window.opera;
function isFacebookApp() {
return (ua.indexOf("FB_IAB") > -1) && (ua.indexOf("FBAV") > -1);
}
if (isFacebookApp()) {
jQuery(function($){
$("<div class='fb_browser_warning'><p>The facebook in-app browser is notoriously buggy. Please switch to a more stable browser.</p></div>").prependTo("#main-content");
});
}
</script>
<?php
}
}
add_action('wp_head', 'fb_browser_warning', 950 ,1);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment