webOS Nation Forums >  Homebrew >  webOS patches > iPhone User Agent Spoof - How to make all mobile websites display perfectly
iPhone User Agent Spoof - How to make all mobile websites display perfectly

  Reply
Like Tree7Likes

 
LinkBack Thread Tools Display Modes
Old 01/09/2012, 02:09 PM   #801 (permalink)
Member
 
Join Date: Aug 2008
Posts: 21
Likes Received: 1
Thanks: 28
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by HaPe View Post
here it is. The backup file is written to /media/internal.

HaPe
This worked for me on 2.2.4, but I now get a "database error: Error: SECURITY_ERR: DOM Exception 18" when I try to use Google Music. I recognize this is off topic for this thread, just reporting back.
summatusmentis is offline   Reply With Quote
Old 01/13/2012, 06:27 PM   #802 (permalink)
Member
 
Join Date: Oct 2010
Posts: 33
Likes Received: 1
Thanks: 4
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by UpTheRams View Post
Pre 3
So the file on page 38 works for the Pre 3 (I haven't tried uninstalling yet as I don't want to break it now it works, but the install is working), but note the following:
1. Youtube and Dailymotion videos do not work from the mobile sites (haven't tried others).
2. Youtube and Dailymotion videos do work from the desktop sites:
- click the small square of squares in the top right corner of the mobile sites;
- select the desktop version;
- Youtube video opened for me in new window as was previously the case, played fine;
- Dailymotion (and possibly others): rotate to landscape, double tap video for "full-screen" zoom.
3. Annoying pop ups telling you that there is "an app for that". Anyone know how to turn these off?
Can someone please fix this!!! So annoying! I tried showing my boss a video on Youtube and forgot about the workaround...how embarrassing. It would be nice if it worked
JetUni is offline   Reply With Quote
Old 02/07/2012, 12:05 PM   #803 (permalink)
Member
 
Join Date: Jan 2012
Posts: 27
Likes Received: 1
Thanks: 5
Thanked 1 Time in 1 Post
Default

Any work on getting drupal / joomla / etc to natively detect webOS as a mobile device? e.g. I believe there's a drupal patch for its mobile module, but yet to be integrated into is latest release.
getsun is offline   Reply With Quote
Old 02/10/2012, 10:48 AM   #804 (permalink)
Member
 
Join Date: Jan 2010
Location: Metro Detroit, MI
Posts: 102
Likes Received: 2
Thanks: 4
Thanked 4 Times in 3 Posts
Default

How about we try setting the useragent as the browser from an Android phone with the same screen res as the Pre3 ?
MekkelRichards is offline   Reply With Quote
Old 02/11/2012, 10:10 PM   #805 (permalink)
Member
 
Join Date: Sep 2009
Location: Canada
Posts: 1,488
Likes Received: 311
Thanks: 64
Thanked 660 Times in 214 Posts
Default

This wont work for webos 3.0.5... it says it cant find the file specified...any idea why? THanks

Quote:
Originally Posted by zingalala View Post
I did a quick hack for HP TouchPad running webOS 3.0.2. I patched the user agent string to that of iPad. See if you can use this.

Code:
#!/bin/sh

# Edited by Anonymous to support HP TouchPad, webOS 3.0.2

# User Agent Spoofer for webOS devices (universal)
# Copyright 2009-2010 Carl E. Thompson (devel-webos [at] carlthompson.net)
# Much help from hofs1 and wtgreen at PreCentral.net . Thank you.

PATCH_VERSION="2.5"

# these must be the same length
# these are for webOS 3.0.2
OLD_UA='Mozilla/5.0 (%s; Linux; %s/%s; U; %s) AppleWebKit/534.6 (KHTML, like Gecko) %s/234.40.1 Safari/534.6 %s/%s'
NEW_UA='Mozilla/5.0 (iPad; U; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/'

# these are for webOS 2.0
OLD_UA_2_0='Mozilla/5.0 (webOS/%s; U; %s) AppleWebKit/532.2 (KHTML, like Gecko) Version/1.0 Safari/532.2 %s'
NEW_UA_2_0='Mozilla/5.0 (iPhone; U; en)(webOS/%s; U; %s) AppleWebKit/532.2 Version/1.0 Safari/532.2 %s -CET'

# these are for webOS 1.2 and 1.3
OLD_UA_1_2='Mozilla/5.0 (webOS/%s; U; %s) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 %s'
NEW_UA_1_2='Mozilla/5.0 (iPhone; U; en)(webOS/%s; U; %s) AppleWebKit/525.27.1 Version/1.0 Safari/525.27.1 %s -CET'

# these are for webOS 1.1
OLD_UA_1_1='Mozilla/5.0 (webOS/1.1; U; %s) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Pre/1.0'
NEW_UA_1_1='Mozilla/5.0 (iPhone; U; en)(webOS/1.1; U; %s) AppleWebKit/525.27.1 Version/1.0 Safari/525.27.1 Pre/1.0 -CET'

WEBOS_VERSION=$(cat /etc/palm-build-info | sed -nre "s/^PRODUCT_VERSION_STRING\s*=\s*HP webOS\s*(.*)/\1/p")

FILE="/usr/lib/libWebKitLuna.so"
BACKUP_FILE="/usr/lib/libWebKitLuna.so-iphone_user_agent-${WEBOS_VERSION}.bak"
TEMP_FILE="/tmp/libWebKitLuna.so-iphone_user_agent.patched"

do_error() { while [ -n "$1" ]; do echo "ERROR: $1" >&2; shift; done; exit 1; }

options() { echo "Available command line options: install, uninstall, restore-backup, help"; }

clear_browser_cookies()
{
    cp -f /var/palm/data/browser-cookies.db . || do_error "Could not copy browser cookies database"
    sqlite3 browser-cookies.db "delete from Cookies;" || do_error "Could not clear browser cookies"
    mv -f browser-cookies.db /var/palm/data/browser-cookies.db || do_error "Could not update browser cookies database"
}

remove_all_backups() { rm -f /usr/lib/libWebKitLuna.so-iphone_user_agent*; }

sedify() { echo "$1" | sed -e 's/\//\\\//g' -e 's/(/\\(/g' -e 's/)/\\)/g'; }

do_patch()
{
        if grep -Fq "$2" $FILE
        then
            echo "User agent already in desired state so no action appears necessary. Exiting."
            exit 0
        fi
        grep -Fq "$1" $FILE || do_error "Could not find area to patch (unknown file version?)"
        OLD=$(sedify "$1")
        NEW=$(sedify "$2")
        sed -re "s/$OLD/$NEW/" $FILE > $TEMP_FILE || do_error "Could not patch file"
        mv -f $TEMP_FILE $FILE || do_error "Could not rename patched file to original name"
}

remount() { mount / -oremount,rw || do_error "Could not remount root filesystem read/write"; }

echo "User Agent Spoofer version $PATCH_VERSION for all Palm webOS devices"
echo "Copyright 2009 - 2010 Carl E. Thompson (devel-webos [at] carlthompson.net)"
echo "Much help from hofs1 and wtgreen at PreCentral.net . Thank you."
echo
echo "This program patches the web browser on a webOS device to add an \"iPhone\" tag"
echo "to the identifying string it sends to web sites (along with the normal webOS"
echo "and Palm device tags). This causes most web sites that don't know about webOS"
echo "devices to think that it is an iPhone and send the iPhone optimized version"
echo "of the web page rather than a generic unoptimized version. Since the browser"
echo "on webOS devices can display the iPhone version of web pages correctly, this"
echo "allows nearly all mobile web sites to display an optimized version on webOS"
echo "devices even without direct support for them."
echo

[ -n "$WEBOS_VERSION" ] || do_error "This patch only runs on Palm webOS devices"

# if this is webOS 1.2 or 1.3
if echo "$WEBOS_VERSION" | grep -Eq "^1\.[23]($|[^0-9])"
then
    OLD_UA="$OLD_UA_1_2"
    NEW_UA="$NEW_UA_1_2"
# if this is webOS 1.1
elif echo "$WEBOS_VERSION" | grep -Eq "^1\.1($|[^0-9])"
then
    OLD_UA="$OLD_UA_1_1"
    NEW_UA="$NEW_UA_1_1"
elif echo "$WEBOS_VERSION" | grep -Eq "^2\.0($|[^0-9])"
then
    OLD_UA="$OLD_UA_2_0"
    NEW_UA="$NEW_UA_2_0"
fi

# Make sure user agent strings are the same length
[ "${#OLD_UA}" = "${#NEW_UA}" ] || do_error "Old and new user agent strings are not the same length"

[ -n "$1" ] && OPT="$1" || OPT="install"

case "$OPT" in
    -u|--uninstall|-uninstall|uninstall)
        echo "Removing user agent spoof patch. Phone will reboot when done."
        remount
        do_patch "$NEW_UA" "$OLD_UA"
        remove_all_backups
        ;;

    -i|--install|-install|install)
        echo "Applying user agent spoof patch. Phone will reboot when done."
        remount
        remove_all_backups
        cp -f $FILE $BACKUP_FILE || do_error "Could not copy original file to backup"
        do_patch "$OLD_UA" "$NEW_UA"
        ;;

    -r|--restore-backup|-restore-backup|restore-backup)
        echo "Restoring library file from backup. Phone will reboot when done."
        [ -r $BACKUP_FILE ] || do_error "Backup file for this version of webOS not found (not installed?)"
        remount
        mv -f $BACKUP_FILE $FILE || do_error "Restoring from backup failed"
        remove_all_backups
        ;;

    -c|--clear-cookies|-clear-cookies|clear-cookies)
        echo "Clearing browser cookies only. Phone will reboot when done."
        ;;

    -h|--help|-help|help)
        options
        exit 0
        ;;

    *)
        do_error "Unknown option: $OPT" "$(options)"
        ;;
esac

clear_browser_cookies
sync
/sbin/reboot || do_error "Reboot failed"
__________________
Please Donate if you like my patches and work. Thanks
rmausser is offline   Reply With Quote
Old 02/29/2012, 06:31 PM   #806 (permalink)
Member
 
Join Date: Feb 2012
Posts: 1
Likes Received: 0
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The method described in this topic doesn't work on 2.1.2 Veers. The update script fails with "Could not rename patched file to original name" error message. This obviously happens because libWebKitLuna.so is ~12MB, and there's no 12 MBs left on the parition hosting the /usr/lib directory. (Actually, I didn't try rebooting the phone after the fail, but I'm pretty sure it would have been "bricked" - ie. need a doctoring -, because there was the original .so backed up, and a slightly shorter patched libWebKitLuna.so, which most likely would have failed to load at startup.)

The solution is to use novabrowser to download the original libWebKitLuna.so from the phone, patch the file on your computer (any binary-safe file editor can be used), and then delete the original libWebKitLuna.so from the phone and upload the patched libWebKitLuna.so to the Veer again.

Last edited by felrefordit; 02/29/2012 at 06:44 PM.
felrefordit is offline   Reply With Quote
Old 03/19/2012, 11:34 AM   #807 (permalink)
Member
 
Join Date: Nov 2010
Location: Texas
Posts: 10
Likes Received: 0
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by HaPe View Post
here it is. The backup file is written to /media/internal.

HaPe
I just tried this on a 2.2.4 pre3 and tried a mobile banking site and can't get the site to switch over to the iOS version. Ill report back if anything changes.

UPDATE getting the same Google music errors....annoying
__________________
samsung sgh-e317 --> iPhone 2g --> Blackberry Pearl --> iPhone 2g --> iPhone 3g --> Blackberry Curve 8310 --> Palm Pre + --> Palm Pre 3/ iPhone 4/HD2(WP7/ICS)

Last edited by greg787; 03/24/2012 at 09:40 PM.
greg787 is offline   Reply With Quote
Old 04/12/2012, 06:11 AM   #808 (permalink)
Member
 
Furuboru's Avatar
 
Join Date: Feb 2008
Posts: 340
Likes Received: 8
Thanks: 132
Thanked 50 Times in 37 Posts
Default

Quote:
Originally Posted by HaPe View Post
here it is. The backup file is written to /media/internal.

HaPe
This did it for my Pre 3 2.2.4 WR. Any updates for the TouchPad 3.0.5?
Furuboru is offline   Reply With Quote
Old 04/13/2012, 12:56 AM   #809 (permalink)
Member
 
Join Date: Jan 2010
Posts: 172
Likes Received: 1
Thanks: 92
Thanked 36 Times in 20 Posts
Default

Quote:
Originally Posted by Furuboru View Post
This did it for my Pre 3 2.2.4 WR. Any updates for the TouchPad 3.0.5?
Works on my pre3 , but youtube does not work anymore
veerar is offline   Reply With Quote
Old 04/13/2012, 11:30 AM   #810 (permalink)
Member
 
nova_ck's Avatar
 
Join Date: Jul 2011
Posts: 19
Likes Received: 0
Thanks: 5
Thanked 1 Time in 1 Post
Default

For TouchPad webOS 3.0.5 we should change OLD_UA to :

OLD_UA='Mozilla/5.0 (%s; Linux; %s/%s; U; %s) AppleWebKit/534.6 (KHTML, like Gecko) %s/234.83 Safari/534.6 %s/%s'

I have tested on my TouchPad webOs 3.0.5 with NEW_UA from ipad /iphone and Macintosh , works fine !
But when we used UA of ipad , we have no control bar on Youtube , i dont know why , but i think because it's difference between webOS browser and iOS browser .

Now I used UA of Macintosh ( thanks eieiosoftware ) and It's work amazing on my TouchPad .

P/S : Change this file to change-user-agent.sh
And from the command line type :
/media/internal/change-user-agent.sh
Attached Files
File Type: txt change-user-agent.sh.txt (5.4 KB, 22 views) Email Attachment
nova_ck is offline   Reply With Quote
Old 04/14/2012, 03:23 AM   #811 (permalink)
Member
 
Furuboru's Avatar
 
Join Date: Feb 2008
Posts: 340
Likes Received: 8
Thanks: 132
Thanked 50 Times in 37 Posts
Default

Had a sync problem with Chapura's PocketMirror on my Pre 3 after the spoof, turns out they need the last %s/%s part of the string (i.e. Pre/3.0) to verify your phone with their servers.

Edited the patch to this instead:

Quote:
OLD_UA='Mozilla/5.0 (Linux; webOS/%s; U; %s) AppleWebKit/534.6 (KHTML, like Gecko) %s/221.56 Safari/534.6 %s/%s' #webOS 2.2.4
#OLD_UA='Mozilla/5.0 (Linux; webOS/%s; U; %s) AppleWebKit/534.6 (KHTML, like Gecko) %s/221.54 Safari/534.6 %s/%s' #webOS 2.2.3
NEW_UA='Mozilla/5.0 (iPhone; U; en)(webOS/%s; U; %s) AppleWebKit/534.6 Version/1.0 Safari/534.6 %s/221.56 %s/%s'
Best of both worlds now

Tempted to merge all these patches into an ALL-IN-ONE patch (TouchPad 3.0.5, Pre 3 2.2.4, etc.) but no time yet.

Oh, and the youtube problem? Just surf to Youtube from the browser and search from there. Videos play nicely. Haven't tried it without my mod though. But the separate Youtube app will default to the iPhone UA.
Furuboru is offline   Reply With Quote
Old 05/05/2012, 03:21 AM   #812 (permalink)
Member
 
Goyena's Avatar
 
Join Date: Nov 1999
Location: Lyon, France
Posts: 837
Likes Received: 44
Thanks: 81
Thanked 110 Times in 67 Posts
Default

I have a Pre 3 with 2.2.4. Thanks for this; I have YouTube with the workaround to use the desktop link. i do need Flash from time to time, so I have a few questions that I didn't see answered above:

- Is there a way to adjust the resolution for the Pre 3 by using another UA?
- Is there a way to switch on the fly (without reboot, like Chrome 17)
- Is there a way to install/uninstall on the road (without a computer/WOSQI)?
__________________
Pixi Plus - Pre Plus - Pre 2 - Pre 3 - Touchpad 1 ;-)
Goyena is offline   Reply With Quote
Old 05/05/2012, 06:45 AM   #813 (permalink)
Member
 
matteebee13's Avatar
 
Join Date: Jan 2010
Location: Seattle
Posts: 607
Likes Received: 26
Thanks: 51
Thanked 57 Times in 52 Posts
Default

Try this: Hulu Patch for Pre 3!
matteebee13 is offline   Reply With Quote
Old 05/05/2012, 07:42 AM   #814 (permalink)
Member
 
Goyena's Avatar
 
Join Date: Nov 1999
Location: Lyon, France
Posts: 837
Likes Received: 44
Thanks: 81
Thanked 110 Times in 67 Posts
Default

Quote:
Originally Posted by matteebee13 View Post
Why? Does the patch replace the need for the user agent change script, or does it enable Flash after having applied the UA change? I wasn't able to glean this from the thread.

I did try to start /media/internal/user-agent-change from wTerm directly on the Pre 3, but it said I didn't have the permission; perhaps I didn't have root. I'm not a Linux person; can you tell me how to get it? From what little I know, I tried "su" but was asked for a password (which is what?) and "sudo" but was told "not found".

Help?

-- Sent from my Palm Pre3 using Forums
__________________
Pixi Plus - Pre Plus - Pre 2 - Pre 3 - Touchpad 1 ;-)
Goyena is offline   Reply With Quote
Old 05/05/2012, 02:09 PM   #815 (permalink)
Member
 
matteebee13's Avatar
 
Join Date: Jan 2010
Location: Seattle
Posts: 607
Likes Received: 26
Thanks: 51
Thanked 57 Times in 52 Posts
Default

Quote:
Originally Posted by Goyena View Post
Why? Does the patch replace the need for the user agent change script, or does it enable Flash after having applied the UA change? I wasn't able to glean this from the thread.

I did try to start /media/internal/user-agent-change from wTerm directly on the Pre 3, but it said I didn't have the permission; perhaps I didn't have root. I'm not a Linux person; can you tell me how to get it? From what little I know, I tried "su" but was asked for a password (which is what?) and "sudo" but was told "not found".

Help?

-- Sent from my Palm Pre3 using Forums
What exactly are you trying to achieve? Change screen resolution? What user agent are you trying to change it to and for what purpose? The Pre3 user agent spoof described in the link I provided has instructions for on device install/uninstall "on the fly" (using xecutah). The patch changes your user agent to spoof hulu and several other sites along with the flash player id (I think). From my personal experience, I am able to watch slingbox and hulu with the patch installed. Youtube has to be changed to the desktop version to work and most websites are shown as desktop version, which is much harder to view on a mobile device. So I only use the patch when I want to watch live tv or tivo and uninstall it for browsing (using xecutah). Some advice: Always make a backup and know how to uninstall a patch before you install in case something goes wrong. I can probably help if you can be slightly more specific about what you are trying to do. And a reboot is really not so bad, but I hear you, it can be slightly inconvenient.
matteebee13 is offline   Reply With Quote
Old 05/07/2012, 06:58 AM   #816 (permalink)
Member
 
Goyena's Avatar
 
Join Date: Nov 1999
Location: Lyon, France
Posts: 837
Likes Received: 44
Thanks: 81
Thanked 110 Times in 67 Posts
Default

Quote:
Originally Posted by matteebee13 View Post
What exactly are you trying to achieve? Change screen resolution? What user agent are you trying to change it to and for what purpose? The Pre3 user agent spoof described in the link I provided has instructions for on device install/uninstall "on the fly" (using xecutah). The patch changes your user agent to spoof hulu and several other sites along with the flash player id (I think). From my personal experience, I am able to watch slingbox and hulu with the patch installed. Youtube has to be changed to the desktop version to work and most websites are shown as desktop version, which is much harder to view on a mobile device. So I only use the patch when I want to watch live tv or tivo and uninstall it for browsing (using xecutah). Some advice: Always make a backup and know how to uninstall a patch before you install in case something goes wrong. I can probably help if you can be slightly more specific about what you are trying to do. And a reboot is really not so bad, but I hear you, it can be slightly inconvenient.
I was searching for a way to install and uninstall the patch directly on the device, and you answered my question: to use Xecutah. Thanks! I had previously uninstalled that app, thinking wTerm would do for all my terminal needs, but for some reason I couldn't execute the script. wTerm gave me "permission denied" but from Xterm, I had no trouble at all. (can anyone explain why?)

I also had the mistaken impression that Flash would be somehow deactivated, but I realize now that a site will deliver a non-Flash page if it detects the iPhone user agent, and if such a page is available, so I can leave the spoof on mostly.

I use Panel's gMaps app to get French traffic (72ka's app doesn't have it; French traffic isn't available through the APIs) and some personal map layers on Google apps, and the spoof makes the app to display on only 2/3 of the screen. Inconvenient, but not that tragic. (anyone know how to tweak this so it doesn't happen?)
__________________
Pixi Plus - Pre Plus - Pre 2 - Pre 3 - Touchpad 1 ;-)
Goyena is offline   Reply With Quote
Reply

 

Thread Tools
Display Modes



 


Content Relevant URLs by vBSEO 3.6.0