473,218 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,218 software developers and data experts.

Why does it seem impossible to read a simple, small textfile on the server with client-side code?

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?
Jul 20 '05 #1
4 1565
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)
Jul 20 '05 #2


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/

Jul 20 '05 #3
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/

Jul 20 '05 #4
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?

Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: David Webb | last post by:
The problem started when the Working Folder for a project was somehow set to the folder of another project. I set the correct working folder in VSS and deleted the .vbproj files that had been...
3
by: nsh | last post by:
mailing.database.mysql, comp.lang.php subject: does "LOAD DATA" EVER work?!? I've tried EVERYTHING! version info: my isp is running my web page on a linux box with php ver. 4.4.1 according to...
16
by: lawrence k | last post by:
I've a file upload script on my site. I just now used it to upload a small text document (10k). Everything worked fine. Then I tried to upload a 5.3 meg Quicktime video. Didn't work. I've...
11
by: jean-jeanot | last post by:
I can access to a file with the command: file_obj = open ( " D:\My documents\Textfile.txt",'r') When I now try to read a file with the following command: file_obj = open ("D:\My...
130
by: Daniel Manes | last post by:
I'm baffled. I have a column in a SQL Server Express database called "Longitude," which is a float. When I view the table in a DataGridView, some of the numbers, which only have two decimal places...
1
by: Daniel | last post by:
how does ado.net SqlDataReader.GetString() know which encoding to read the data into a string as? Does sql sever set this at the column data type level, server wide encoding setting, os encoding?
7
by: Marc Bartsch | last post by:
Hi, I have a background worker in my C# app that makes a synchronous HttpWebRequest.GetResponse() call. The idea is to POST a file to a server on the internet. When I call HttpWebRequest.Abort()...
1
by: Pankaj Kumar | last post by:
when i read from client browser it gives message such as "logon failure: unknown user name or bad"
3
by: Raymond Chiu | last post by:
Dear all, Now I have the simple task to read text file line by line into database (SQL Server 2000). If the text file is divided into different fields according to the number of characters,...
3
by: =?Utf-8?B?RnJhbmsgVXJheQ==?= | last post by:
Hi all I am trying to loop a Textfile. This Textfile is located on a shared drive and it is used by another process. When I try to read it I get an exeption: The process cannot access the...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.