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


i've trying make links on of pages "mobilized" great service google mobilizer: http://www.google.com/gwt/x?u=

is there way prefix of links within div or element, rather link site.com/link becomes http://www.google.com/gwt/x?u=site.com/link ?

i'm thinking might work:

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

i'm not sure how code it. if know how it's done thankful!

i think useful you:

  1. download file mobile_detect.php @ github
  2. put on root of server
  3. put code @ beginning of every page 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 this site , works fine


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -