dongnaopa6200 2011-04-27 18:16
浏览 55
已采纳

PHP检测Opera

How can I detect Opera with PHP? Im using lightbox with drupal and their is a bug in opera, so if the site is being viewed with opera I want to print a normal link instead of the lightbox.

I found this link but it just says 'other browser' not opera: http://drupal.org/node/65903

This prints the browser being used and seems to work fine:

<?php echo $_SERVER['HTTP_USER_AGENT']; ?> 

So can I modify the code to print something if the browser is opera? If so, are their any pit falls to this method?

Thanks

  • 写回答

3条回答 默认 最新

  • doufeng9567 2011-04-27 18:20
    关注

    You could try using http://chrisschuld.com/projects/browser-php-detecting-a-users-browser-from-php/, it looks like an useful script, however, if that PHP code you entered is echoing something you can use to change how the link is rendered, then that might be fine. The only thing is that you should use a some loose string comparison, not a strict one, because Opera's user agents might change between versions or operating systems.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示