Javascript geoPlugin使用IE取消定义变量
我有几个网站正在使用,在2012年9月24日微软IE更新之后,我遇到了一些奇怪的问题。我第一次注意到我的nivo滑块没有出现在我的主页上,所以我在控制台中找到了一个Javascript geoPlugin使用IE取消定义变量,javascript,internet-explorer-8,internet-explorer-9,cross-domain,Javascript,Internet Explorer 8,Internet Explorer 9,Cross Domain,我有几个网站正在使用,在2012年9月24日微软IE更新之后,我遇到了一些奇怪的问题。我第一次注意到我的nivo滑块没有出现在我的主页上,所以我在控制台中找到了一个 SCRIPT5009:“geoplugin\u countryCode”未定义 然后我在谷歌Chrome上调试了同一个页面,一切正常。我试图破译KB2744842公告中关于该更新的内容 以下是我的javascript: <script src="https://ssl.geoplugin.net/javascript.gp"
SCRIPT5009:“geoplugin\u countryCode”未定义
然后我在谷歌Chrome上调试了同一个页面,一切正常。我试图破译KB2744842公告中关于该更新的内容
以下是我的javascript:
<script src="https://ssl.geoplugin.net/javascript.gp" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
var country = geoplugin_countryCode();
if(country === 'CA'){
$('#notification').html('<div class="attention" style="display: none;">You are in Canada</div>');
$('.attention').fadeIn('slow');
$('html, body').animate({ scrollTop: 0 }, 'slow');
}else if(country != 'US'){
$('#notification').html('<div class="attention" style="display: none;">You are in the USA</div>');
$('.attention').fadeIn('slow');
$('html, body').animate({ scrollTop: 0 }, 'slow');
}else{
//nothing stupid IE
}
});
$('.geoClose').live('click', function() {
console.log('geoplugin notify closed');
document.cookie = 'geoClose=true;'
});
</script>
$(文档).ready(函数(){
var country=geoplugin_countryCode();
如果(国家=='CA'){
$('#notification').html('您在加拿大');
$('.attention').fadeIn('slow');
$('html,body')。动画({scrollTop:0},'slow');
}否则,如果(国家!=“美国”){
$('#notification').html('您在美国');
$('.attention').fadeIn('slow');
$('html,body')。动画({scrollTop:0},'slow');
}否则{
//没什么蠢事
}
});
$('.geoClose').live('click',function()){
console.log('geoplugin notify closed');
document.cookie='geoClose=true;'
});
HTML:
标题文本
内容在这里!
geoPlugin最近更改了一些有关SSL请求的策略,显然IE不会遵循实施的重定向,而其他浏览器会遵循
结果代码:
<script src="http://www.geoplugin.net/javascript.gp" type="text/javascript"></script>
<script src="http://www.geoplugin.net/statistics.gp" type="text/javascript"></script>
<!--<script src="https://ssl.geoplugin.net/javascript.gp" type="text/javascript"></script>-->
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
var country = geoplugin_countryCode();
if(country === 'CA'){
$('#notification').html('<div class="attention" style="display: none;">You are in Canada</div>');
$('.attention').fadeIn('slow');
$('html, body').animate({ scrollTop: 0 }, 'slow');
}else if(country != 'US'){
$('#notification').html('<div class="attention" style="display: none;">You are in the USA</div>');
$('.attention').fadeIn('slow');
$('html, body').animate({ scrollTop: 0 }, 'slow');
}else{
//nothing stupid IE
}
});
$('.geoClose').live('click', function() {
console.log('geoplugin notify closed');
document.cookie = 'geoClose=true;'
});
//]]>
</script>
//
<script src="http://www.geoplugin.net/javascript.gp" type="text/javascript"></script>
<script src="http://www.geoplugin.net/statistics.gp" type="text/javascript"></script>
<!--<script src="https://ssl.geoplugin.net/javascript.gp" type="text/javascript"></script>-->
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
var country = geoplugin_countryCode();
if(country === 'CA'){
$('#notification').html('<div class="attention" style="display: none;">You are in Canada</div>');
$('.attention').fadeIn('slow');
$('html, body').animate({ scrollTop: 0 }, 'slow');
}else if(country != 'US'){
$('#notification').html('<div class="attention" style="display: none;">You are in the USA</div>');
$('.attention').fadeIn('slow');
$('html, body').animate({ scrollTop: 0 }, 'slow');
}else{
//nothing stupid IE
}
});
$('.geoClose').live('click', function() {
console.log('geoplugin notify closed');
document.cookie = 'geoClose=true;'
});
//]]>
</script>