🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: best.general
Article #328

Javascript, SSI's, cookies

#328
From: Andrew Maisel
Date: Thu, 11 Oct 2001 21:23
31 lines
1944 bytes
Is there a way to use javascript or an SSI to read a [session] cookie,
then include a header file depending on the presence or absence or value
of that cookie?  (rather than using a cgi script)

When I try this with javascript, I run into a problem when the script
tries to do the include -- if the contents of the file to be included is
more than one line long, the document.write command apparently chokes. 
Although the file contents show up in the source, the browser does not
show it.

javascript snippet
---------------------
var foo = getCookie('foo');
getCookie('foo');
if (foo == 'red') {
 document.write('<!--#include
file="/webadmin/home/pub/login/public_html/test.html" -->');
}
else {
...
}


Alternatively, I'm wondering if there is a way to do this without
javascript, by just using a conditional expression in an SSI...


Thx in advance for any pointers!

Andrew Maisel
http://www.superkids.com/
Technical Details
Message-ID: <3BC60DBD.19B3E030@superkids.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news-peer-west.sprintlink.net!news.sprintlink.net!enews.sgi.com!news1.best.com!nntp1.ba.best.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f9f6d,e3a236c74c55f283,start
X-Google-Attributes: gidf9f6d,public
X-Google-ArrivalTime: 2001-10-11 14:18:24 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news-peer-west.sprintlink.net!news.sprintlink.net!enews.sgi.com!news1.best.com!nntp1.ba.best.com!not-for-mail
From: Andrew Maisel <andrew@superkids.com>
Newsgroups: best.general
Subject: Javascript, SSI's, cookies
Date: Thu, 11 Oct 2001 14:23:09 -0700
Organization: The ISP formerly known as Best
Lines: 31
Distribution: best
Message-ID: <3BC60DBD.19B3E030@superkids.com>
NNTP-Posting-Host: andrewm.vip.best.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: nntp1.ba.best.com 1002835099 61277 206.86.6.7 (11 Oct 2001 21:18:19 GMT)
X-Complaints-To: abuse@best.com
NNTP-Posting-Date: Thu, 11 Oct 2001 21:18:19 +0000 (UTC)
X-Mailer: Mozilla 4.03 [en] (Win16; I)