0

私はModernizrを使用して非対応のSVGブラウザーを検出し、それをサポートしていないブラウザー用に追加のスタイルシートをロードしています。画像はcssのbackground-urlsによって設定されます。

最初はAndroidブラウザに画像が表示されませんが、ページを更新すると画像が読み込まれます。そうする前に、キャッシュがクリアされていることを確認しました。私もJqueryMobileを使用していますが、そのスタイルは使用していません。

これが私のヘッダーです:

    <head>
    <meta charset="utf-8">
    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
    <title>My Website</title>

    <meta http-equiv="x-dns-prefetch-control" content="off">

    <meta name="viewport" content="width=device-width, target-densityDpi=160, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <link href="<?php bloginfo('template_url'); ?>/css/reset.css" rel="stylesheet" />
    <link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" />

    <script type="text/javascript" src="http://use.typekit.com/abv4xxx.js"></script>
    <script type="text/javascript">try{Typekit.load();}catch(e){}</script>

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/mobile.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/modernizer.js"></script>
    <script type="text/javascript">

    Modernizr.load({
    test: Modernizr.svg,
        nope: '<?php bloginfo("template_url"); ?>/css/nono-svg.css'
    });

    </script>
    <?php wp_head(); ?>
</head>
4

1 に答える 1

0

私は解決策を見つけました。jsスクリプトをmodernizrのloadコマンドに移動する必要がありました。

<head>
    <meta charset="utf-8">
    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
    <title>My Website</title>

    <meta http-equiv="x-dns-prefetch-control" content="off">

    <meta name="viewport" content="width=device-width, target-densityDpi=160, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <link href="<?php bloginfo('template_url'); ?>/css/reset.css" rel="stylesheet" />
    <link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" />

    <script type="text/javascript" src="http://use.typekit.com/abv4xxx.js"></script>
    <script type="text/javascript">try{Typekit.load();}catch(e){}</script>

    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/modernizer.js"></script>
    <script type="text/javascript">

    Modernizr.load({
        load: ['https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js',
            '<?php bloginfo("template_url"); ?>/js/mobile.js',
            'http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js'
        ],
        test: Modernizr.svg,
            nope: '<?php bloginfo("template_url"); ?>/css/nono-svg.css'
    });

    </script>
    <?php wp_head(); ?>
</head>
于 2012-08-23T14:39:58.633 に答える