Wow! Where has the year gone?!? How can it be September already? It’s been a beautiful year and it’s gone by so quickly…
An MIT alum and entrepreneur wrote me recently with a good question. While building out and testing a new e-commerce site, they encountered a very strange useragent and wanted to build a custom detection method to catch it. He wasn’t sure the best way to integrate such a custom detection feature into the codebase. This is what I might recommend.
Let’s say you were using PHP. To keep the code fairly modular and easy to maintain over time, I might recommend creating a custom DetectXXX() method that you could easily copy forward into new MobileESP versions. If you wanted to check automatically every time, then put a call to it in the DetectMobileQuick() method. For example:
function DetectMobileQuick() { //Keep all the stuff at the top unchanged... //Finally, call your custom method if ($this->DetectCustomAgents() == $this->true) return $this->true; else return $this->false; }
function DetectCustomAgents() { if (stripos($this->useragent, "silly_that_i_have_to_do_this") > -1) return $this->true; else return $this->false; }
Good luck on your new venture, Bill!
– Anthony
– Anthony