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


Groups > comp.lang.javascript > #31650

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 <5c66e503-f057-4113-ae7a-d177d882b78c@googlegroups.com> <581eee8e$0$857$e4fe514c@news.xs4all.nl> <e8a3ad62-b789-48c2-b0a8-ef77a0bab0a8@googlegroups.com> <581f749e$0$881$e4fe514c@news.xs4all.nl>
Date 2016-11-07 09:48 +0100
Message-ID <XnsA6B963CDAFB85eejj99@194.109.6.166> (permalink)

Show all headers | View raw


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>


-- 
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