Homepage.nsf and different browser languages

Hi forum.I couldn’t find somehting helpful in the postings, so…

I would like homepage.nsf to do the following:

1 A user access to homepage.nsf

  1. a script or formula gets the browser’s language.

  2. Script or formula opens frameset in user’s language.

I have written scripts that do open different framesets, but I can’t find a way, to get them activated, when users access the server (resp. homepage.nsf) over the web. There should be something like a queryopen for a database or something similar. May be I am just walking in the wrong direction.

And i have found fromuals to get to the user’s browser Version or OS version, but not the browser’ language.

Any suggestions?

Every comment is welcome.

Thanks

Klaus

Subject: CGI variable

Klaus,

  1. Use the CGI variable “HTTP_Accept_language” on your startpage to find out which languages the browser client accepts (as specified by HTTP headers). You will get a list of language codes like this “en-us,en-gb;q=0.7”

  2. If you know the accepted languages you can use this to redirect the user to the correct frameset. You can use for example the $$HTMLHead field for building the correct frameset.

  • Anti Ohne -

Subject: CGI variable

Klaus,

  1. Use the CGI variable “HTTP_Accept_language” on your startpage to find out which languages the browser client accepts (as specified by HTTP headers). You will get a list of language codes like this “en-us,en-gb;q=0.7”

  2. If you know the accepted languages you can use this to redirect the user to the correct frameset. You can use for example the $$HTMLHead field for building the correct frameset.

  • Anti Ohne -

Subject: RE: CGI variable

Thanks. I think I roughly understand the direction you’re suggesting.

Excuse me being a pest, but I am afraid, I am not deep enough into this yet, to really understand where to go from here.

Would you mind explaining this a bit more detailed? The parts I dont’t understand are:

  1. On a page, I cant’t create fields to get hold of a variable. So how do I do this?

  2. Where exactly do I define “building the correct frameset”?

  3. In the start-options of the database - what do I define in the option “When opened in a browser” - the “about database document”? An do my programming in there?

Thanks a lot in advance.

Klaus

Subject: Explination

Klaus,

I saw that you have an already working solution which works with an agent. My solution was based an a form (no need for an agent). For example a form named “Homepage”. On this form you would have several fields:

  • HTTP_Accept_language

  • $$HTMLHead → in this field you would compute your frameset code with @formula’s. If the user was a german user the german URL’s and al the other users the english URL’s

This form you would referer to in the URL or if it was a starting URL for your website in the server document / website document.

Do a search for $$HTMLHead in LDD Today and check for example this article: http://www-10.lotus.com/ldd/today.nsf/62f62847467a8f78052568a80055b380/0ad43b5de337c0c2852566c50059fe95?OpenDocument&Highlight=0,%24%24HTMLHead

  • Anti Ohne -

Subject: homepage.nsf and different browser languages - solved

here’s my agent, that is launched via open-url in server document or directly in browser:

(all you need is to copy-paste this agent into your db and have the designated frameset prepared.)

sub initialize

  Print "Content-Type:text/plain"

  Print "Content-Type:text/html"



  Print "<HTML>"



  Dim session As New NotesSession

  Dim doc As NotesDocument

  Set doc = session.DocumentContext



  Print "<H2>" + doc.Subject(0) + "</H2>"

  Print "<H2>IP address is " + doc.Remote_Addr(0) + "</H2>"

  Print "<H2>Sprache: " + doc.HTTP_Accept_language(0) + "</H2>"

  Print "<H2>Browser: " + doc.HTTP_User_Agent(0) + "</H2>"

  Print "<H2>HTTPS: " + doc.HTTPS(0) + "</H2>"

  Print "<H2>Remote Host: " + doc.Remote_Host(0) + "</H2>"

  Print "<H2>Remote Ident: " + doc.Remote_Ident(0) + "</H2>"

  Print "<H2>Remote User: " + doc.Remote_User(0) + "</H2>"

  Print "<H2>Server Name: " + doc.Server_Name(0) + "</H2>"

  Print "<H2>Server Protocol: " + doc.Server_Protocol(0) + "</H2>"

  Print "<H2>Server Port: " + doc.Server_Port(0) + "</H2>"

  Print "<H2>Server Software: " + doc.Server_Software(0) + "</H2>"



  lang = "en"

  If Instr(1,doc.HTTP_Accept_Language(0),"de",5) <> 0 Then

        lang = "de"

  End If

  Print "<H2>Sprache: "lang"</H2>"



  Print "<HEAD>"



  Select Case lang

  Case "en"

        Print "<META HTTP-EQUIV=""Refresh""

CONTENT=““10;URL=http://chzns510/chz_db/ID1/budget.nsf/Frameset.Start.en?Open””>"

  Case "de"

        Print "<META HTTP-EQUIV=""Refresh""

CONTENT=““10;URL=http://chzns510/chz_db/ID1/budget.nsf/Frameset.Start.de?Open””>"

  End Select



  Print "</HEAD>"

  Print "</HTML>"

end sub