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:
- download file
mobile_detect.php
@ github - put on root of server
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
Post a Comment