Change Adobe Air apps default browser

Written on Jul 07, 2009 // Open Source.

Adobe Air BrowserI’m currently using Adobe Air just for Twitter clients, Seesmic and TweetDeckTweetDeckTweetDeck. I noticed that the browser used to open links was not the gnome default one (Epiphany in my case) but FirefoxFirefoxFirefox. After looking for firefox string into the apps folder I tried looking for it on the adobe air installation directory and… yes that was there.

Unfortunately it’s compiled in a .so files and as I couldn’t recompile it I decided using mighty vim to do the dirty trick.

First of all, to avoid segmentation faults errors the file have to remain of the same bytes of the original one => as firefox is composed by 7 chars I had to replace it with a 7 chars executable.  I then created a symlink called browser (7 digits) pointing to my epiphany binary

ln -s /usr/bin/epiphany /usr/local/bin/browser

Then I opened the .so file with vim ( in my case adobe air was installed on /opt/air , but this may vary depending on your installation method)

vim /opt/air/runtimes/air/linux/Adobe\ AIR/Versions/1.0/libCore.so

On vim I went to line 15500 doing

:15500

then looked for ‘firefox‘ and replaced it with ‘browser‘.
If you can’t find ‘firefox’ at line 15500 it’s probably due to a different sdk version. Try at line 16104 as suggested in the comments.
Closed and saved with

:wq

I then restarted the app and the links were being opened with epiphany. Using the symlink makes it very easy to switch from one browser to an other one. For example I switched from epiphany to Google ChromeChromeChrome just doing

rm /usr/local/bin/browser && ln -s /opt/chrome/google-chrome /usr/local/bin/browser

Update: ubuntu users

In the comments, Victor gave some good advices for Ubuntu users.

Update: more abstraction

In the comments, mjg reported how to improve abstraction using x-www-browser

Update: default browser on Gnome Environments

In the comments, saidimu pointed out how to preserve your default browser preferences in Ubuntu


  • WilliamGCash
    Can you do this using Windows XP as well or is this just a Linux correction?
  • Hi William,

    I'm sorry but I really don't know...I hope someone else can help you better...
  • LeRishel
    I tried this but when I open the .so file on vim it just returns dump chars, this is what I get when I jump to line 15500 ^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~^?<80><81><82><83><84><85><86><87><88><89><8a><8b><8c><8d><8e><8f><90><91><92><93><94><95><96><97><98><99><9a><9b><9c><9d><9e><9f> ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾, and so on. Does anyone know what the problem is? BTW using ubuntu 9.04
  • Al.
    Yes. Adobe Air has released a new update and now "firefox" word is in line 16104.
  • Thanks a lot I updated the post with the information you provided!
  • LeRishel
    Thanks, tried searching it but had a hard time because found firefox a couple of times and didn't know which one to change. It know works like a charm.
  • Bob Hazard
    In case they move it again the line looks like @firefox for me it was the last mention, you can ignore the earlier ones such as /usr/lib/firefox
  • Thanks Andrea!
    In Jaunty this works but with one or two slight changes. AIR is located in a different directory:

    $ locate libCore.so

    /opt/Adobe AIR/Versions/1.0/libCore.so

    Also, AIR couldn't seem to find "browser" in /usr/local/bin/browser, so this worked:

    $ cd /usr/bin
    $ sudo ln -s /usr/bin/firefox-3.5 browser

    Thanks again so much!

    Victor Kane
    http://awebfactory.com.ar
  • Hi Victor,

    thanks for your contribute, I linked your comment on the post to help Ubuntu Users finding your steps.

    Have a nice day...
  • To transparently preserve your default browser preferences in Ubuntu (and other Gnome desktops), link to xdg-open instead of firefox. This way if you change your default browser, for example to chrome, you still get your links opened in your browser of choice.

    $ cd /usr/bin
    $ sudo ln -s xdg-open browser

    A great post. Thanks.
  • Thanks for your comment, I updated the post linking to your suggestion
  • On newer Linux distributions, value of GNOME_DESKTOP_SESSION_ID is not set to "Default" and that causes all the problems. Just use the following command and it should fix the problem (and you will not need to touch the .so file):
    export GNOME_DESKTOP_SESSION_ID=Default
  • On my distribution (Linux Mint), it says that GNOME_DESKTOP_SESSION_ID="this-is-deprecated"

    Guess it shouldn't be used then.
  • Same here... and same conclusion too
  • I've tried everything posted here, and nothing worked :(... i really don't know what else to do.

    I'm runing Linux Mint, Using Firefox 3.5, and i linked the to "browser" perfectly. I can even click on it and it'll open the HomePage in a new window.

    I think i just don't know WHERE to place "browser" so AIR can find it. I even recover de old libcore.so after i attempt everysingle thing here because this is my first time using Linux and i don't want to mess things up.

    Does it have to do with the fact that the way i "installed" FF3.5 was just coping the extract directory from my Desktop to "/"??? or is it because my OS is in Spanish?

    Thanks for listening...
  • Hi Azrel,

    are you sure you put the link correctly in the /usr/bin directory ? As you placed your firefox installation in the Desktop the command you gave should be something like sudo ln -s ~/Desktop/Firefox-3.5/firefox /usr/bin/browser

    Also, are you sure that you replace the right 'firefox' word inside the libcore.so file?
  • I did link it properly, but i had to reinstall LMint for another reasons so that problem got solved too... Thanks do. ;)
  • Yes, you are right that it should not have been used by AIR. But till we get the next update, this would be the cleanest approach to fix the issue.
  • THANKS THANKS THANKS!!!!!!

    ^^

    Note: Thanks again!!!!
  • :D No problem !
  • Thank you!
  • mjg
    Works like a charm! Though I pointed my browser symlink at /usr/bin/x-www-browser to maximize my levels of abstraction.

    Thanks much.
  • Glad it works for you too!
    Thanks for pointing out your improvement, that's probably the best choice instead of changing the link everytime !
  • Pedro Olivarez
    This worked for me in Ubuntu 9.10 (Karmic Koala) / TweetDeck v0.31.3, though the entry was at line 16104 as AI mentioned. (I tried the GNOME_DESKTOP_SESSION_ID solution first, but that didn't work for me.)

    I would have thought hard-coding the browser would be very bad practice.
blog comments powered by Disqus