eBook authors eBook Software - create and publish your own ebooks
Create your own eBooks
Learn How To Create, Publish & Market E-Books
E-Book Creation Software
Add sophisticated multimedia to your E-Books
Create E-Book covers in minutes
E-Book Marketing & Promotion made easy
Search engine for E-Books
Interviews with eBook authors
Tools for building better eBooks
Archived Message:

Auto Updater

jmiguy I'd like to write a javascript that will check my ebook's web page for the ebook title(including the most current version number) and compare it with the customer's copy.

If the customer's book version matches the most current version on my site,  I would like a message in the ebook to say "No Updates Available."

If the version numbers don't match I would like it to say "New Updates Are Available - Click here to download."

Since I have very little experience with javascript, I thought I'd see if any of you guru's out there have written a script of this sort that might help me along.



Posted on: 11:11 pm on July 18, 2006
Alaska jmiguy -

Here is a link to a zipped activ project that reads values from a .js file:


It demos using a form to get information from the user, and how to write and read a file with this information.

 It wouldn't be much of a stretch to provide variables - currentVersion and latestVersion values in your ebook .js and website .js files.  

If your website .js file latestVersion Is Greater Than the ebook's currentVersion, you read those website values, and save them in that local .js file, like the demo does.

Posted on: 3:58 am on July 24, 2006
jmiguy Roger,

Thanks for the reply and for the files. I'll take a look at them and see if I can figure out what you mean.


Posted on: 6:35 pm on July 24, 2006
jmiguy Okay,

here's where I'm at so far:

I created the csinfo.js script using this data:

var ffname="jeff";  
var flname="testing";  
var faddress ="form";  
var fcity="data";  
var fstate="input";

The script is included in the ebook.

The data populates in the bottom form fields.

If I want to pull the data from my web server, do I just have to change the source from this:

SCRIPT LANGUAGE="JavaScript" SRC="csinfo.js"

to this:

SCRIPT LANGUAGE="JavaScript" SRC="http://www.mywebsite.com/csinfo.js" ? (And upload the script to my webserver)



P.S. is the clipbrd.exe file anything important?

Posted on: 9:05 pm on July 25, 2006
Alaska Jeff -

You will want to add a variable to each .js file, indicating the version.  The csinfo.js file would have the value where 'currentVersion=1;' and 'latestVersion = 1;'.

In your ebook page, you put both calls for the js files, one after the other.  First the local file, then call the website .js file.

The local file establishes the installed or last update version. We called it 'currentVersion=1;'.  The information you want to update is kept in variables as well (like, 'currentGreeting ="Hi!" ', or whatever).

So, you read the local .js file, then the website .js file.... The beauty is, if the script can't see the .js file because you're not online, or you forgot to upload it, it won't throw an error. . . neat.

 Anyway, the second .js file tells you that the 'latestVersion = 2'.  The contents contains values ('latestGreeting ="Happy Holidays!",' or whatever) with new information.

When the ebook starts up, it compares the values.

If currentVersion < latestVersion {

currentGreeting = latestGreeting;
currentSponsor = latestSponsor; .... and....

currentVersion= latestVersion;
 ....and then you write those values, including the new currentVersion and latestVersion values, into your local js file, as I did in the demo....


Next time you start up, if there are no updates, the version numbers will match, and your ebook will read and use the local information.  If they are not online, it will use the local information as well, updated the last time they went online.

Good enuff?

Posted on: 3:55 am on July 27, 2006
Alaska Oh, and regarding the last question:

The demo's reference at the bottom link to 'clipbrd.exe' is a simple demo on using the "##RUN()" Activ command to launch a built-in Windows application from the ebook.

It brings up Window's little-used Clipboard ClipBook album, useful when you copy a lot of things into memory.

Posted on: 4:01 am on July 27, 2006
jmiguy Roger,

Thanks for all of your help. I greatly appreciate it. I'm fairly certain that I follow what you're saying.

One question, when you say to call the website .js file, is this the correct way to do it:

SCRIPT LANGUAGE="JavaScript" SRC="http://www.mywebsite.com/csinfo.js"

Thanks again (you've been tremendously helpful)


Posted on: 7:13 pm on July 27, 2006
Alaska Jeff -

Yes.  But don't forget the Less Than and Greater Than signs: the "<" and ">" . . .

<SCRIPT LANGUAGE="JavaScript" SRC="http://www.mywebsite.com/csinfo.js">

Posted on: 3:24 am on July 28, 2006
jmiguy Roger,

Good news. I got it working. Now I'm just trying to tweak it out.

I set it up where I have two forms. One checks the local .js file and the other checks the webserver .js file.

I set the action of each form to point to the readfile.as scripts. I didn't need the writefile.as. (So far anyway)

I compared the value of "currentver" with "latestver." If currentver < latestver I include a message to update the e_Book.

I'm also going to include a button or link that appears if updates are available that you can click on to download the latest version.

I just have one more question...

Javascript only runs when you're viewing the page that calls the script, right?

(I just want to be certain that my webserver is not getting any unnecessary traffic with these scripts running.)

Thanks again for all of your help.


Posted on: 8:53 pm on July 29, 2006
Alaska Jeff -

Javascript only runs when you're viewing the page that calls the script, right?

You'll want to be able to write the .js file as well, to save the updated info.  Otherwise, the reader won't see it if they're offline.

Posted on: 3:18 am on July 30, 2006
jmiguy I e-mailed you a copy of what I have so far. It works great except for when I disconnect from the Internet.

Now I see what you mean about wanting to write to the file to maintain the data in the form fields.

I removed the submit buttons, so I hope there is a way to dynamically submit the data so it gets written to the file. (Maybe when the page loads)

I can live with it the way it is now, but if you have any ideas to fix this I'd love to hear them.

Thanks again,


Posted on: 5:50 am on July 30, 2006
Alaska Jeff-

Glad things are looking up.

If you look at the demo, you might find the point where the file is written.  You'll want to copy that, and paste it, implementing it right after the part that does the variable update. You'll also have to include that .as file that does the writing itself.

I can look at it if you're still having trouble finding that line of script.  I'll try to get to it asap, but I'm a bit swamped - I'm trying to 'whip out' a free, advertising-driven site (I hope), with a ton of articles and ebooks I've collected in these past years;http://www.800tip.com.  Might be something there to inspire an ebook subject.

It's taken me over a week now to 'whip it out', and I am way tardy on eveything else , but I'll help where I can.

best -

Posted on: 9:57 pm on July 30, 2006

List All Archived Forums

Copyright © 2000-2018, Answers 2000 Limited.

With any business, it is up to the individual owner of said business to ensure the success of the business. You may make more or less than any sample figures or results that might be quoted on our web sites or other publications. All business involves risk, and many businesses do not succeed. Further, Answers 2000 Limited does NOT represent that any particular individual or business is typical, or that any results or experiences achieved by any particular individual/business is necessarily typical.

Disclosure: Our company's websites' content (including this website's content) includes advertisements for our own company's websites, products, and services, and for other organization's websites, products, and services. In the case of links to other organization's websites, our company may receive a payment, (1) if you purchase products or services, or (2) if you sign-up for third party offers, after following links from this website. Unless specifically otherwise stated, information about other organization's products and services, is based on information provided by that organization, the product/service vendor, and/or publicly available information - and should not be taken to mean that we have used the product/service in question. Additionally, our company's websites contain some adverts which we are paid to display, but whose content is not selected by us, such as Google AdSense ads. For more detailed information, please see Advertising/Endorsements Disclosures

Our sites use cookies, some of which may already be set on your computer. Use of our site constitutes consent for this. For details, please see Privacy.

Click privacy for information about our company's privacy, data collection and data retention policies, and your rights.

Contact Us    About and Terms Of Use    Privacy    Advertising/Endorsements Disclosures