Trouble getting browser version
-
Hi,
$browser_version is generating 0.0 instead of current browser version.
In my functions.php file I have a little function to print javascript variables into the head of the document so they’ll be available to other scripts. It is intended to pass the browser name and version to my js script.
It is working partially; it prints the script tag into the head and gets the browser name right, but shows the browser version as 0.0 instead of the current version. Can anyone spot what is wrong, or help me to troubleshoot the problem?
Here is the code from my functions file:
_________________
// add js variables to the head // Add content to wp_head() function oursitename_head_script() { global $browser_name, $browser_version; $browser_name = get_browser_name(); $browser_version = get_browser_version(); echo '<script type="text/javascript">var browserName = "'.$browser_name.'"; var browserVersion = "'.$browser_version.'";</script>'; echo PHP_EOL; } add_action( 'wp_head', 'oursitename_head_script' );
_____________
The site is: bestofyourtown.com
Thanks!
Viewing 13 replies - 1 through 13 (of 13 total)
Viewing 13 replies - 1 through 13 (of 13 total)
- The topic ‘Trouble getting browser version’ is closed to new replies.