|
|
[lp_client_browser]Description
Returns the name, version, OS, type and typecode of the client browser in a map.
Browser types: Parameters
Sample Usage
Source CodeClick the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.lp_client_browser.zip (28.87 kb)
Comments
01/30/2008, Johan Sölve
Small adjustments [trying better formatting] I moved the browser profile config vars into the ctag (and changed them to locals) to make it more self-contained (also seems slightly faster actually), and I also added caching in a global (limited to 10000 entries) so client_browsers we have seen before will have the info returned immediately without further processing. Cached client types are returned in 2-3ms instead of 75-80ms on my MacBook. Code additions for the cache (it would also need thread locking to be completely safe) -- near the beginning: if: (global: '_lp_client_browser_cache') >> #client_browser; return: $_lp_client_browser_cache -> find(#client_browser); /if; and near the end: !(global: '_lp_client_browser_cache') -> isa('map') ? global: '_lp_client_browser_cache' = map; if: $_lp_client_browser_cache -> size < 10000 && $_lp_client_browser_cache !>> #client_browser; $_lp_client_browser_cache -> insert(#client_browser = #return); /if; return: #return;
01/30/2008, Johan Sölve
Small adjustments I moved the browser profilee config vars into the ctag (and changed them to locals) to make it more self-contained (also seems slightly faster actually), and I also added caching in a global (limited to 10000 entries) so client_browsers we have seen before will have the info returned immediately without further processing. Cached client types are returned in 2-3ms instead of 75-80ms on my MacBook. Code additions for the cache (it would also need thread locking to be completely safe) -- near the beginning: if: (global: '_lp_client_browser_cache') >> #client_browser; return: $_lp_client_browser_cache -> find(#client_browser); /if; and near the end: !(global: '_lp_client_browser_cache') -> isa('map') ? global: '_lp_client_browser_cache' = map; if: $_lp_client_browser_cache -> size < 10000 && $_lp_client_browser_cache !>> #client_browser; $_lp_client_browser_cache -> insert(#client_browser = #return); /if; return: #return; |
||||||||||||||||||||
Correction
After realizing that the browser config variables should be globals instead of vars or locals (so they don't have to be defined each time), execution time without cache is now 5-6 ms compared to 2-4 ms with cache. In other words, not much to gain with the caching. I'm withdrawing my suggested changes.