Advertisement
retiredbutstillcodin

Workaround for Chrome not working in Firefox

Dec 15th, 2013
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.79 KB | None | 0 0
  1. <?php
  2. $msie = strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE') ? true : false;
  3. $firefox = strpos($_SERVER["HTTP_USER_AGENT"], 'Firefox') ? true : false;
  4. $safari = strpos($_SERVER["HTTP_USER_AGENT"], 'Safari') ? true : false;
  5. $opera = strpos($_SERVER["HTTP_USER_AGENT"], 'Opera') ? true : false;
  6. $chrome = strpos($_SERVER["HTTP_USER_AGENT"], 'Chrome') ? true : false;
  7. $crios = strpos($_SERVER['HTTP_USER_AGENT'], 'CriOS')  ? true : false;
  8. ?>
  9.  
  10. <?php
  11. //Firefox
  12. if ($firefox || $safari || $msie || $opera && (!$chrome || !$crios)) { ?>
  13. <div id="amazon_search">
  14. <script charset="utf-8" type="text/javascript" src="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&amp;MarketPlace=US&amp;ID=V20070822/US/stcaccessabil-20/8002/afbd9144-5e7d-4aa3-ba17-cb43a5f5a94c">
  15. </script>
  16. <noscript><p><a href="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&amp;MarketPlace=US&amp;ID=V20070822%2FUS%2Fstcaccessabil-20%2F8002%2Fafbd9144-5e7d-4aa3-ba17-cb43a5f5a94c&amp;Operation=NoScript">Amazon.com Widgets</a></p></noscript>
  17. </div>
  18. <?php } ?>
  19.  
  20. <?php
  21. // Chrome. Uses the engine - webkit
  22. if ($chrome || $crios && (!$firefox|| !$safari || !$msie || !$opera)) { ?>
  23. <div id="amazon_search">
  24. <img style="float:left; margin-right:0.4em; vertical-align:top;" src="wp-content/uploads/amazon_assoc_search_box-96x80.png" width="96" height="80" alt="small amazon search box"><strong>If you are using the Google Chrome browser</strong> or not using Javascript, you can&#039;t see our Amazon Associates search box here. <strong>Use Firefox, Safari, Opera, or other browser</strong> to use the search box or go directly <a href="http://wms.assoc-amazon.com/20070822/US/html/searchbox_27.html?t=stcaccessabil-20">to our search box with our embedded code</a>. We are sorry Chrome no longer supports the Amazon.com widget.
  25. </div>
  26. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement