Hi,
This is my situation:
My ISP doesn't allow me the execute server-code. So, no ASP or otherwise.As
a small compensation, they run some CGI scripts that we can use. With one of
these scripts I maintain a set of counters, one on each of my HTML pages
that they host. It is all very basic, the files are no more then textfiles
that ONLY contain the number of hits, as a characterstring. The filename is
free for me to choose, the extension MUST BE "xbm". So, for the counter on
the Links page that has had 248 hits uptill now, the file would be
"links.xbm", with the contents "248". A file with length 4 (EOL is 1
character). What I would like is to be able client-side to read these
counterfiles. But as far as I can tell it is not possible.
One trick in Javascript would be to create an extra, hidden, frame on my
page and load the file into that frame. The frame contents would then
reflect the contents of the file. Unfortunately, since the file's extension
is 'xbm', the file is not recognized as textual, and the frame will contain
the file as a <IMG> tag.
In VBScript you could think that the FileSystemObject could do the trick.
However, that acts on the local system, i.e. the pc of the client and not on
the server: an URL is not a valid filepath. Besides, it will generate an
Active-X warning and I don't want that.
Any help? 4 1453
Marcel Brekelmans wrote on 24 jan 2004 in
microsoft.public.scripting.jscript: Hi,
This is my situation:
My ISP doesn't allow me the execute server-code. So, no ASP or otherwise.As a small compensation, they run some CGI scripts that we can use. With one of these scripts I maintain a set of counters, one on each of my HTML pages that they host. It is all very basic, the files are no more then textfiles that ONLY contain the number of hits, as a characterstring. The filename is free for me to choose, the extension MUST BE "xbm". So, for the counter on the Links page that has had 248 hits uptill now, the file would be "links.xbm", with the contents "248". A file with length 4 (EOL is 1 character). What I would like is to be able client-side to read these counterfiles. But as far as I can tell it is not possible.
One trick in Javascript would be to create an extra, hidden, frame on my page and load the file into that frame. The frame contents would then reflect the contents of the file. Unfortunately, since the file's extension is 'xbm', the file is not recognized as textual, and the frame will contain the file as a <IMG> tag.
In VBScript you could think that the FileSystemObject could do the trick. However, that acts on the local system, i.e. the pc of the client and not on the server: an URL is not a valid filepath. Besides, it will generate an Active-X warning and I don't want that.
IE:
function getUrl(url) {
var http = new ActiveXObject("microsoft.xmlhttp");
http.open("GET",url,false);
http.send();
return http.responseText;
}
Yes, you will get a warning, but clientside javascript is possible
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Marcel Brekelmans wrote: My ISP doesn't allow me the execute server-code. So, no ASP or otherwise.As a small compensation, they run some CGI scripts that we can use. With one of these scripts I maintain a set of counters, one on each of my HTML pages that they host. It is all very basic, the files are no more then textfiles that ONLY contain the number of hits, as a characterstring. The filename is free for me to choose, the extension MUST BE "xbm". So, for the counter on the Links page that has had 248 hits uptill now, the file would be "links.xbm", with the contents "248". A file with length 4 (EOL is 1 character).
And the ISP does provide the CGI to have counters but it doesn't provide
tools or doesn't explain how to include a counter value in an HTML page?
Tell them to associate the .xbm suffix with text/plain and you can use
an iframe to include that value.
Or use an external counter service, I guess there are still free counter
services around.
What I would like is to be able client-side to read these counterfiles. But as far as I can tell it is not possible.
Some browsers do provide features/apis to client side JavaScript
allowing to read from a URL on the same server but how would that help
on the Web for users with JavaScript disabled or of browsers not
supporting that?
As for reading values, for IE5+/Win you can use the download behaviour,
see the section about that in http://www.faqts.com/knowledge_base/...d/1268/fid/126
for IE5+/Win and Netscape 6+ you can also use the XMLHttpRequest and
read the responseText property, see the FAQ http://jibbering.com/faq/#FAQ4_38
--
Martin Honnen http://JavaScript.FAQTs.com/
Marcel Brekelmans wrote: Hi,
This is my situation:
My ISP doesn't allow me the execute server-code. So, no ASP or otherwise.As a small compensation, they run some CGI scripts that we can use. With one of these scripts I maintain a set of counters, one on each of my HTML pages that they host. It is all very basic, the files are no more then textfiles that ONLY contain the number of hits, as a characterstring. The filename is free for me to choose, the extension MUST BE "xbm". So, for the counter on the Links page that has had 248 hits uptill now, the file would be "links.xbm", with the contents "248". A file with length 4 (EOL is 1 character). What I would like is to be able client-side to read these counterfiles. But as far as I can tell it is not possible.
One trick in Javascript would be to create an extra, hidden, frame on my page and load the file into that frame. The frame contents would then reflect the contents of the file. Unfortunately, since the file's extension is 'xbm', the file is not recognized as textual, and the frame will contain the file as a <IMG> tag.
In VBScript you could think that the FileSystemObject could do the trick. However, that acts on the local system, i.e. the pc of the client and not on the server: an URL is not a valid filepath. Besides, it will generate an Active-X warning and I don't want that. http://www.jibbering.com/faq/#FAQ4_38
Either an HTTPRequest object (limited browser support - still an ActiveX
warning) or a Java applet. The above URL explains.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
For IE you can use download behaviuor: http://msdn.microsoft.com/library/de...asp?frame=true
--
Joe
"Marcel Brekelmans" <ne********@marcel-art.com> wrote in message
news:HS********************@amsnews02.chello.com.. . Hi,
This is my situation:
My ISP doesn't allow me the execute server-code. So, no ASP or
otherwise.As a small compensation, they run some CGI scripts that we can use. With one
of these scripts I maintain a set of counters, one on each of my HTML pages that they host. It is all very basic, the files are no more then textfiles that ONLY contain the number of hits, as a characterstring. The filename
is free for me to choose, the extension MUST BE "xbm". So, for the counter on the Links page that has had 248 hits uptill now, the file would be "links.xbm", with the contents "248". A file with length 4 (EOL is 1 character). What I would like is to be able client-side to read these counterfiles. But as far as I can tell it is not possible.
One trick in Javascript would be to create an extra, hidden, frame on my page and load the file into that frame. The frame contents would then reflect the contents of the file. Unfortunately, since the file's
extension is 'xbm', the file is not recognized as textual, and the frame will
contain the file as a <IMG> tag.
In VBScript you could think that the FileSystemObject could do the trick. However, that acts on the local system, i.e. the pc of the client and not
on the server: an URL is not a valid filepath. Besides, it will generate an Active-X warning and I don't want that.
Any help?
This discussion thread is closed Replies have been disabled for this discussion. Similar topics
5 posts
views
Thread by David Webb |
last post: by
|
3 posts
views
Thread by nsh |
last post: by
|
16 posts
views
Thread by lawrence k |
last post: by
|
11 posts
views
Thread by jean-jeanot |
last post: by
|
130 posts
views
Thread by Daniel Manes |
last post: by
|
1 post
views
Thread by Daniel |
last post: by
|
7 posts
views
Thread by Marc Bartsch |
last post: by
| |
3 posts
views
Thread by Raymond Chiu |
last post: by
|
3 posts
views
Thread by =?Utf-8?B?RnJhbmsgVXJheQ==?= |
last post: by
| | | | | | | | | | | |