×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    20

    Open Browser in N95

    Hey there,

    Is there a guideline on howto launch a browser from a python script, I saw that in another post:


    >url = '4 www.symbian.com' # 4 means Start/Continue the browser specifying a URL
    >b = 'BrowserNG.exe' # or with the full path b='z:\\sys\\bin\\BrowserNG.exe[
    >e32.start_exe(b, ' "%s"' %url, 1) # the space between ' and " seems to be important so don't miss it!
    >Note: I have only been able to start the browser with the give url when the browser settings->Home pages is set to 'Bookmarks'.

    http://discussion.forum.nokia.com/fo...p/t-84137.html

    Is there a guideline what these numbers mean? When I open a browser with the snippet above it open but it remains in the bookmark view. How do I make sure the URL is show and not the bookmark view.

    Thanks for any info,
    Stan

  2. #2
    Registered User
    Join Date
    Feb 2005
    Location
    Belgium (Europe)
    Posts
    1,352

    Re: Open Browser in N95

    Quote Originally Posted by whoisstan View Post
    Hey there,

    Is there a guideline on howto launch a browser from a python script, I saw that in another post:


    >url = '4 www.symbian.com' # 4 means Start/Continue the browser specifying a URL
    >b = 'BrowserNG.exe' # or with the full path b='z:\\sys\\bin\\BrowserNG.exe[
    >e32.start_exe(b, ' "%s"' %url, 1) # the space between ' and " seems to be important so don't miss it!
    >Note: I have only been able to start the browser with the give url when the browser settings->Home pages is set to 'Bookmarks'.

    http://discussion.forum.nokia.com/fo...p/t-84137.html

    Is there a guideline what these numbers mean? When I open a browser with the snippet above it open but it remains in the bookmark view. How do I make sure the URL is show and not the bookmark view.

    Thanks for any info,
    Stan
    Hello Stan

    Recently Nokia has unveiled what these magic number (4 is only one of them !) means :

    Info below is Extracted from Forum Nokia Wiki

    Here is some additional information about the parameters that are passed as command line arguments when launching the OSS Browser:

    1. Start/Continue the browser and nothing is specified (the default case)
    => Parameter = <Any text>

    2. Start/Continue the browser specifying a Bookmark
    => Parameter = “1”+”<Space>“+”<Uid of the Bookmark>”

    3. Start/Continue the browser specifying a Saved deck
    => Parameter = “2”+” <Space>“+”<Uid of the Saved deck>”

    4. Start/Continue the browser specifying a URL
    => Parameter = “4”+” <Space>“+”<Url>”

    5. Start/Continue the browser specifying a URL and an Access Point
    => Parameter = “4”+”<Space>“+”<Url>”+”<Space>“+”<Uid of Ap>”

    6. Start/Continue the browser with the start page. (Used when starting the browser with a long press of “0” in the Idle state of the phone.
    => Parameter = “5”

    7. Start/Continue the browser specifying a Bookmark folder
    => Parameter = “6”+” <Space>“+”<Uid of the Folder>”

    So it is now possible to use in PyS60

    Cyke64
    pys60 1.4.5 and 2.0.0, pygame, PyS60 CE on E90 and 5800 !

    Find my pys60 extension modules on cyke64.googlepages.com

  3. #3
    Registered User
    Join Date
    Oct 2007
    Posts
    20

    Re: Open Browser in N95

    Hey,

    thanks for the quick feedback, so if I want to open a URL in a browers I go for.

    >4. Start/Continue the browser specifying a URL
    >=> Parameter = “4”+” <Space>“+”<Url>”

    In my case that opens the bookmark view and asks me to select an access point, then it is loading the page in the background (i can tell b/c the options menu is blended out) and when it is ready the options menu appears again and i can choose "Back to Page" from the Options Menu to go to the page. That is of course much much to complicated especially for real world users. Here is my code:

    def open(url):
    browser = 'BrowserNG.exe'
    e32.start_exe(browser, ' "%s"' %url, 1)

    open("4 www.semapedia.org")

    I tried with changing my homepage which was Bookmarks and set it to a web address page with no luck, now the new homepage instead of the url comes up. I use symbian apps on my phone which do start a browser and everything works as expected.

    What shall I do?

    Any help is appreciated,
    Stan

  4. #4
    Registered User
    Join Date
    Oct 2007
    Posts
    20

    Re: Open Browser in N95

    Hey,

    i still haven't figured it out. I tried:

    def open( url ):
    browser = 'BrowserNG.exe'
    e32.start_exe(browser, ' "4 %s"' %url, 1)

    def open( url ):
    browser = 'BrowserNG.exe'
    e32.start_exe(browser, ' "%s 4"' %url, 1)

    I get the page to load, but I still need to go to the options menu and select "Back to page". Is there a way to load url in the browser immediatly without going through that via python and start_exe?

    Any help is appreciated very much,
    Stan

  5. #5
    Registered User
    Join Date
    Oct 2007
    Posts
    20

    Talking Re: Open Browser in N95

    Hi,

    that is latest piece for my application everything else is safe and sound under python. How do I open a browser in a N95 with a URL and make page show right away. I refuse to accept that this is not possible, can't be

    Best,
    Stan

  6. #6
    Super Contributor
    Join Date
    May 2004
    Location
    Tampere, Finland
    Posts
    524

    Re: Open Browser in N95

    Quote Originally Posted by whoisstan View Post
    How do I open a browser in a N95 with a URL and make page show right away. I refuse to accept that this is not possible, can't be
    How about utilizing the MIME type content hander to open a local document, which immediately redirects the page to whatever address you want? Like this:

    Code:
    import e32
    import appuifw
    
    url = "http://www.google.com"
    redirectfilepath = r"D:\redirect.html"  # Temporary file on RAMDisk
    
    redirectpage = '''
    <HTML>
    <HEAD><TITLE>Opening page...</TITLE></HEAD>
    <BODY><SCRIPT>document.location="%s"</SCRIPT></BODY>
    </HTML>
    ''' % url
    
    # Write a temporary redirect file.
    redirectfile = open(redirectfilepath, "w")
    redirectfile.write(redirectpage)
    redirectfile.close()
    
    # Launch redirect file using an application registered for HTML (the browser).
    mimehandler = appuifw.Content_handler()
    mimehandler.open(redirectfilepath)
    
    # Browser never returns.
    The downside of this approach is that mimehandler.open() opens the browser in the same thread on which Python runs, i.e. Python is stopped at that point. The browser never returns to the Python interpreter, at least on an N95. mimehandler.open_standalone() would correct this, but it does not work on my N95 for some reason.

  7. #7
    Registered User
    Join Date
    Oct 2007
    Posts
    20

    Re: Open Browser in N95

    Thanks so much, that is a start. I can't get back to the python app either, but it serves my purpose so far. Great help!

    Anybody else out there knowing how to launch the browser without stopping the current python app?


    Stan

  8. #8
    Regular Contributor
    Join Date
    Jan 2007
    Posts
    80

    Re: Open Browser in N95

    I had a couple of ideas that might work... but they didn't work for me, one is to have the browser open in a new thread.. but that didn't seem to work, the other is to have a second program that just reads the file in E:/redirect.html and opens it in the browser, and then have this program be opened from the other program using e32.start_server("e:/python/browser_server.py") but that didn't seem to work either..

    Anybody have any other clues?

  9. #9
    Super Contributor
    Join Date
    May 2004
    Location
    Tampere, Finland
    Posts
    524

    Re: Open Browser in N95

    Quote Originally Posted by federico2929 View Post
    the other is to have a second program that just reads the file in E:/redirect.html and opens it in the browser, and then have this program be opened from the other program using e32.start_server("e:/python/browser_server.py") but that didn't seem to work either..
    This method might work with e32.start_exe(), if the browser-opener was packaged in a SIS file and e32.start_server() was used to start its EXE stub in \sys\bin.

  10. #10
    Registered User
    Join Date
    Oct 2007
    Posts
    20

    Re: Open Browser in N95

    Would you have the time to prototype just very bare bones so I can follow you guys? Are you suggesting to start a new python instance altogether that is used to open the browser? The memory situation on my n95 is usually pretty tight when running python and a web browser, not sure what will happen if another python thread is up and running.

    I have a variety of symbian apps that open the browser successfully, never thought that this might even a problem

    Thanks for all the feedback so far,
    Stan

  11. #11
    Registered User
    Join Date
    Jan 2008
    Posts
    2

    Re: Open Browser in N95

    Quote Originally Posted by whoisstan View Post

    When I open a browser with the snippet above it open but it remains in the bookmark view. How do I make sure the URL is show and not the bookmark view.
    I have the same problem and would appreciate help.

  12. #12
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: Open Browser in N95

    Did you try these two things:

    1) FIRST open web browser and make network connection, THEN start your script

    2) Define access point on the command line.

    5. Start/Continue the browser specifying a URL and an Access Point
    => Parameter = “4”+”<Space>“+”<Url>”+”<Space>“+”<Uid of Ap>”
    BEWARE: experimenting with access points might be expensive.

  13. #13
    Registered User
    Join Date
    Jan 2008
    Posts
    2

    Re: Open Browser in N95

    Quote Originally Posted by JOM View Post
    Did you try these two things:

    1) FIRST open web browser and make network connection, THEN start your script

    2) Define access point on the command line.

    BEWARE: experimenting with access points might be expensive.
    these are exactly the two things that don't work. when i quit the web browser and don't define the access point in the command line, then the redirect works. however, i always have to quit the browser and when it starts, i have to define the access point manually.

    when i first open the browser (1), it gets activated by the script but doesn't jump to the web page.

    when i define the access point (2), the browser redirects to the web page but afterwards goes to the bookmark view and stays there.

  14. #14
    Regular Contributor
    Join Date
    Jan 2007
    Posts
    80

    Re: Open Browser in N95

    There has to be a way to do this, the Gmail app in my N95 does it without a problem running from java... there must be some flag that they know that we dont...

  15. #15
    Registered User
    Join Date
    Feb 2006
    Posts
    22

    Re: Open Browser in N95

    Hi all,
    I am trying to open a local html file with the browser on the N95.
    This is the code I am using:


    Code:
    url="file:///e:/index.html"
    e32.start_exe('BrowserNG.exe', "4"+" "+" "+url+" "+"1", 1)
    The browser starts but the page is not shown automatically.
    If I type in the browser the url string, everything works
    Any idea?

    Thanks in advance for any help!
    GP

Similar Threads

  1. ActivateViewL to open Settings on N95
    By dracula78 in forum Symbian User Interface
    Replies: 5
    Last Post: 2008-12-10, 10:09
  2. KHTML Browser bug?
    By presentTech in forum Symbian
    Replies: 2
    Last Post: 2006-09-07, 21:15
  3. 6230 phone browser, could'nt open it
    By habeb10 in forum General Development Questions
    Replies: 2
    Last Post: 2004-05-18, 20:33

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×