문제

IE7 호환 모드와 HTML5와 함께 이상한 문제가 있습니다.

증상 : PHP를 사용하여 PHP를 사용하여 PHP를 사용하면 IE7이라는 것을 감지 할 수 있습니다.양식 제출 버튼을 누르고 리턴 백 버튼을 클릭하면 여전히 호환성 모드에서도 IE7을 더 이상 감지하지 않습니다.IE7로 다시 탐지하기 위해 새로 고침하거나 다시로드되어야합니다.

이렇게 더욱 강력하게 만들기 위해 무엇을 할 수 있습니까?get_browser 및 browscap을 사용하지 마십시오.나는 그 browscap.ini에서 계속 유지하기를 원하지 않습니다.

HTML 헤드 :

<?php 
    /**
    *   IE 7 has trouble with jscrollpane, so disable for all IE except for 9 which works just fine.
    */ 
    $getBrowser = $_SERVER['HTTP_USER_AGENT']; 
    if( (!stristr($getBrowser,'MSIE')) || stristr($getBrowser,'MSIE 9')):
?>
<script src="jquery/jquery.mousewheel.js"></script>
<link  rel="stylesheet" href="styles/jquery.jscrollpane.css" />
<script src="jquery/jquery.jscrollpane.min.js"></script>
<script  src="jquery/js.js"></script>
<?php endif; ?>
.

업데이트 :

$getBrowser = $_SERVER['HTTP_USER_AGENT']; 
        if( stristr($getBrowser,'MSIE') === false)
.

relocated js.js line to :

<!--[if IE 9 ]>
    <script  src="jquery/js.js"></script>
<![endif]-->
.

은 다시 버튼을 눌렀을 때도 똑같습니다.

편집 : 남자 ... 나는 심각한 기계 문제가있는 것 같아요.Windows가있는 상자는 Windows Update 후에 망상 됨이 있어야합니다.이 미친 물건에 대해 죄송합니다.아직 Windows Update를 실행하지 않은 다른 시스템에서 잘 작동합니다.

도움이 되었습니까?

해결책

I don't have IE9 so I can't try it but can't you do something like this and place it on the <head>:

<!--[if IE 9]>
     // your includes here
<![endif]-->

Not sure if it matters to you to still see the script tags included in the source but at least it won't execute them unless the check was satisfied.

다른 팁

As @tradyblix said, you can do this client side. They're called conditional comments.

If you have to do it in the PHP, I would use strpos().

$ua = $_SERVER['HTTP_USER_AGENT'];
if (stripos($ua, 'MSIE') === false || stripos($ua, 'MSIE 9') !== false)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top