Почему IE7 Совместимость назад кнопка PHP не может обнаружить как IE7?
-
14-11-2019 - |
Вопрос
У меня странные проблемы с режимом совместимости IE7 и HTML5.
Симптомы: Идущая непосредственно к моей домашней странице, использование PHP может обнаружить, что он IE7.После удара кнопки «Отправить форма» и нажав кнопку «Вернуться назад», она больше не обнаруживает, что и IE7 даже в режиме совместимости.Должно быть обновлено или перезагружаться, чтобы снова обнаружить, как IE7.
Что я могу сделать, чтобы сделать это более надежным?Пожалуйста, не говорите, чтобы использовать Get_Browser и Browcock.Я не хочу поддерживать поддерживать на этом browcocap.ini.
в HTML Head:
<?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)
.
Переместил строку js.js:
<!--[if IE 9 ]>
<script src="jquery/js.js"></script>
<![endif]-->
.
Все еще делает то же самое при ударе кнопки назад.
Решение
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)