WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Droplets & Snippets => Topic started by: Re-Mi on August 10, 2011, 05:39:33 PM

Title: [[droplet]] browser update checker
Post by: Re-Mi on August 10, 2011, 05:39:33 PM
Hello,

For a site i'm making i wanted a browser update checker, some users still are using an outdated browser that will screw up the template.

So i used this droplet to warn people that they are using an older browser, and it will advice people to update to a more secure (and better template supported) version.

It's making use of an external javascript hosted on the site who provides the latest version, and they update it for the latest browsers

droplet code:
Code: [Select]
return'<script type="text/javascript">
var $buoop = {
    vs: {i:6,f:2,o:9.63,s:2,n:10},  // browser versions to notify
    reminder: 24,                   // atfer how many hours should the message reappear  0 = show all the time
    onshow: function(infos){},      // callback function after the bar has appeared
    l: false,                       // set a language for the message, e.g. "en"  overrides the default detection
    test: false,                    // true = always show the bar (for testing)
    text: "'.$text.'",                       // custom notification html text , leave blank for default
    newwindow: true                // open link in new window/tab
}
$buoop.ol = window.onload;
window.onload=function(){
 if ($buoop.ol) $buoop.ol();
 var e = document.createElement("script");
 e.setAttribute("type", "text/javascript");
 e.setAttribute("src", "http://browser-update.org/update.js");
 document.body.appendChild(e);
}  
</script>';

i used the following name, you can save it as you like. Place the tag anywhere in you index.php to warn the visitor on every page, or in a wysiwyg page to warn them only with that page.
Code: [Select]
[[browsercheck]]
I may look into some changes to give the droplets some parameters, but for now this does work just fine for me. More info on the browser-update.org site (http://browser-update.org/#install)

edit 1: added a parameter for the text, use
Code: [Select]
[[browsercheck?text=your text here]] to add you own text, if you leave this blank it will use the default

Hope this comes in handy for some of you.

Kind regards,

Michel
Title: Re: [[snippet]] browser update checker
Post by: Ruud on August 13, 2011, 12:11:47 AM
Nice idea, and it is working too..

The only thing that crossed my mind is that it could be done even more simple.
So I created a snippet that will do the same thing, but without any extra effort.
Just install the snippet through the admin pages and it should automatically function on every page.

The only thing it needs is that your template should have the frontend.js/css functionality (http://www.websitebaker2.org/en/help/designer-guide/enhanced-template-elements.php#anker4) enabled. (as it should be for other modules too)

You can modify the settings by editting the frontend.js and frontend.css in the snippets directory as explained on the browsers-update.org website (http://browser-update.org/en/customize.html).

[gelöscht durch Administrator]
Title: Re: [[droplet]] browser update checker
Post by: dbs on August 13, 2011, 05:48:29 PM
Hi, have tested the snipped with IETester and it works fine.  
Warning : i:8  :wink: