Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #31655

Re: What's an efficient way to record the number of loading / calling of a JS script file?

Newsgroups comp.lang.javascript
Subject Re: What's an efficient way to record the number of loading / calling of a JS script file?
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References (1 earlier) <581eee8e$0$857$e4fe514c@news.xs4all.nl> <e8a3ad62-b789-48c2-b0a8-ef77a0bab0a8@googlegroups.com> <581f749e$0$881$e4fe514c@news.xs4all.nl> <XnsA6B963CDAFB85eejj99@194.109.6.166> <0aecf8a3-3bda-41f9-8169-0401e2771dc4@googlegroups.com>
Date 2016-11-07 23:51 +0100
Message-ID <XnsA6B9F2BE18FDBeejj99@194.109.6.166> (permalink)

Show all headers | View raw


justaguy <lichunshen84@gmail.com> wrote on 07 Nov 2016 in
comp.lang.javascript: 

> On Monday, November 7, 2016 at 3:48:44 AM UTC-5, Evertjan. wrote:
>> Luuk <luuk@invalid.lan> wrote on 06 Nov 2016 in comp.lang.javascript:
>> 
>> >> The other thing is i've disabled web server log. Thanks tho.
>> > 
>> > The most efficient way to record how many time a client has initiated
>> > a load for that script (which is my interpretation of your question),
>> > is to enable server side logging.
>> 
>> Which will also accomodate for not counting the possible clientside
>> re-use of a cashed version.
>> 
>> Using classic ASP:
>> 
>> // js-file content here, call this file "myJS.asp"
>> <%@ Language="JScript" %>
>> <%
>> var ForReading = 1, ForWriting = 2, count, f;
>> var filename = Server.MapPath("count-myJS-asp.txt");
>> var fso = new ActiveXObject("Scripting.FileSystemObject");
>> 
>> if (fso.FileExists(filename)) {
>>      f = fso.OpenTextFile(filename, ForReading);
>>      count = f.ReadAll();
>>      f.Close();
>> } else {
>>      var f = fso.CreateTextFile(filename, true);
>>      f.Close();
>>      count = 0;
>> };
>> 
>> f = fso.OpenTextFile(filename, ForWriting);
>> // count = -1; // reset counter to 0
>> f.Write(++count);
>> f.Close();
>> %>
>> ================
>> 
>> Read the number into an html-file:
>> 
>> <iframe src = 'count-myJS-asp.txt'> </iframe>
>> 
>> 
> 
> I appreciate it though I'm not an ASP developer.

ASP is fully developed, why would you want to develop it? [joke]

You can do exactly the same in PHP, [or in VBScript, btw]
but then, this is a Javascript NG,
so serverside JS is on topic,
while PHP is not.


-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

What's an efficient way to record the number of loading / calling of a JS script file? justaguy <lichunshen84@gmail.com> - 2016-11-05 14:35 -0700
  Re: What's an efficient way to record the number of loading / calling of a JS script file? Luuk <luuk@invalid.lan> - 2016-11-06 09:49 +0100
    Re: What's an efficient way to record the number of loading / calling of a JS script file? justaguy <lichunshen84@gmail.com> - 2016-11-06 06:42 -0800
      Re: What's an efficient way to record the number of loading / calling of a JS script file? Luuk <luuk@invalid.lan> - 2016-11-06 19:21 +0100
        Re: What's an efficient way to record the number of loading / calling of a JS script file? justaguy <lichunshen84@gmail.com> - 2016-11-06 12:33 -0800
        Re: What's an efficient way to record the number of loading / calling of a JS script file? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-11-07 09:48 +0100
          Re: What's an efficient way to record the number of loading / calling of a JS script file? justaguy <lichunshen84@gmail.com> - 2016-11-07 14:23 -0800
            Re: What's an efficient way to record the number of loading / calling of a JS script file? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-11-07 23:51 +0100
              Re: What's an efficient way to record the number of loading / calling of a JS script file? justaguy <lichunshen84@gmail.com> - 2016-11-08 08:01 -0800
                Re: What's an efficient way to record the number of loading / calling of a JS script file? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-11-08 19:19 +0100
  Re: What's an efficient way to record the number of loading / calling of a JS script file? JJ <jj4public@vfemail.net> - 2016-11-06 20:31 +0700
    Re: What's an efficient way to record the number of loading / calling of a JS script file? justaguy <lichunshen84@gmail.com> - 2016-11-06 06:44 -0800

csiph-web