1

この優れたサービスである Google Mobilizer: http://www.google.com/gwt/x?u=を使用して、いくつかのページのリンクを「動員」しようとしています。

div または要素内のすべてのリンクにプレフィックスを付ける方法はありますか? ?

私はこのようなものがうまくいくかもしれないと考えています:

if (window.location == $LINK)
    window.location = "http://www.google.com/gwt/x?u=" + $LINK;

私はそれをコーディングする方法がわかりません。それがどのように行われたかを知っていれば、私はとても感謝しています!

4

2 に答える 2

0

I think this could be useful for you:

  1. Download the file Mobile_Detect.php at GitHub
  2. Put it on the root of your server
  3. Put this code at the beginning of every page you would redirect

    <?php
    include('Mobile_Detect.php');
    $detect = new Mobile_Detect();
    if ($detect->isMobile()) {header('Location: http://www.google.com/gwt/x?u=http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"],PHP_URL_PATH . '');}
    ?>
    

I tested it with this site and works fine

于 2013-09-13T20:06:27.783 に答える
0

私はこのGoogle Mobilizer ブックマークレットを書きました

要件に合わせてコードを調整できます。

于 2013-10-07T07:45:49.567 に答える