如何调动与http://www.google.com/gwt/x?u=的所有环节

How to mobilize all links with http://www.google.com/gwt/x?u=?

本文关键字:gwt http 何调动 www com google      更新时间:2023-09-26

我试着用这个很棒的服务Google Mobilizer: http://www.google.com/gwt/x?u=让我的一些页面上的链接"被动员起来"

是否有办法为div或元素中的所有链接加上前缀,使链接不是site.com/link而是http://www.google.com/gwt/x?u=site.com/link ?

我在想这样的事情可能会起作用:

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

我只是不确定如何编码。如果你知道它是怎么做的,我将非常感激!

我想这可能对你有用:

  1. 在GitHub下载Mobile_Detect.php文件
  2. 放到你的服务器根目录
  3. 将此代码放在您要重定向的每个页面的开头

    <?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 . '');}
    ?>
    

我在这个网站上测试了一下,效果很好

我写了这个Google Mobilizer书签,因为我很想抓挠。

您可以根据自己的需求调整代码