Open safari from app~?

Discussion in 'iOS Development' started by lgchicken, May 19, 2008.

  1. lgchicken

    lgchicken New Member

    Joined:
    Apr 12, 2008
    Messages:
    80
    Likes Received:
    1
    how do i get an app to open safari to a certain page
    (and possibly close the app)

    ive searched far and wide but i cant find the answer!

    ild like to launch a site from an alert sheet or otherwise, thanks.
  2. optimo

    optimo New Member

    Joined:
    Sep 28, 2007
    Messages:
    535
    Likes Received:
    17
    Code:
    NSURL *url;
    url = [[ NSURL alloc ] initWithString: @"http://ifans.com/" ];
    [ self openURL: url ];
    
    this will open Safari and suspend the current app
  3. Nickll9009

    Nickll9009 New Member

    Joined:
    Sep 19, 2007
    Messages:
    1,367
    Likes Received:
    8
    Device:
    iPod touch
    You can also do this the other way around

    Please Register or Log in to view images



    cd /Applications/MobileSafari.app

    ./MobileSafari &



    if you run that then press the home button it kills the app behind Safari, while leaving Safari open
  4. lgchicken

    lgchicken New Member

    Joined:
    Apr 12, 2008
    Messages:
    80
    Likes Received:
    1
    thanks both of you

Share This Page