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

How to handle online pages if not online


 
Wiplinger I have some frames in the e-book, which get the contain from my server. How can I handle that, if the reader is not online?

I "think" I am looking for a java script, which checks if the content is online available, if not display another page instead.

I am not java expert, ... does anybody has such a solution?


Posted on: 1:10 pm on December 9, 2002
Alaska Ronald -

Ok, I've cleaned up and documented one method here; I'm sure there are others.

[color=navy]1. To establish our online/offline values, we create a text file called ‘local.js’.  This local.js file is kept with your project, has a ‘havewebaccess’ value of ‘0’, and is called like this (items inside of ‘< !—‘ and ‘//->’ are comments)[/color]

< !-- in local.js,   havewebaccess = '0' ; //-->
< SCRIPT LANGUAGE="JavaScript" SRC="local.js">
< SCRIPT>

[color=navy]Inside that local file is the line:[/color]

havewebaccess = '0' ;

[color=navy]2. A second text file, ‘online.js’ is located on your website, and is called the same way.  When the book starts, it searches for and reads the online.js file and gets the havewebaccess value.  That value would be a '1':[/color]

havewebaccess = '1' ;

[color=navy]If the user is online, havewebaccess will be ‘1’.  If not online, no error will display, and havewebaccess will remain ‘0’.[/color]

< !-- in online.js,   havewebaccess = '1' ; //-->
< SCRIPT LANGUAGE="JavaScript" SRC="http://www.yourdomain.com/library/online.js">
< SCRIPT>

[color=navy]3. We set the ‘1’ or ‘0’ to an Activ global variable. [/color]

< SCRIPT>
window.external.ActivSet('hvaccess',havewebaccess);
< /SCRIPT>

[color=navy]4. When needed, we can access that Activ variable in other pages with:[/color]

< SCRIPT>
var havewebaccess = window.external.ActivGet('{hvaccess}') ;
< /SCRIPT>

[color=navy]5. We build two web files: one has the current information, and resides on your website or online area.  It’s called ‘online_update_1.htm’.

The second file is the “not online message”, seen only if havewebaccess = ‘0’; it’s called online_update_0.htm.  It is kept with the project files.[/color]

[color=navy]6. We use the Javascript variable ‘havewebaccess’ to choose between two web pages, one online, and a one a local file with the ‘not online’ message.  This method creates two different hrefs, depending on the value of ‘havewebaccess’:[/color]

< SCRIPT LANGUAGE="JavaScript">
document.write("< A HREF='online_update_" + havewebaccess + ".htm' >“>< IMG SRC='globe_icon" + havewebaccess + ".gif' border=0 align=middle>Online Update< /A > " ) ;
< /SCRIPT>

[color=navy]7. Bonus: Combine the ‘havewebaccess’ variable with the Activ variable for a valid password to show one of four possible icons:[/color]

[color=navy]globe_icon00.gif ( no password entered, not online)
globe_icon10.gif ( password entered, not online)
globe_icon01.gif ( no password entered, online)
globe_icon11.gif ( password entered, online)

...and implement it like this:[/color]

< SCRIPT LANGUAGE="JavaScript">
document.write("< A HREF='online_update_" + havewebaccess + ".htm' >“>< IMG SRC='globe_icon[={iscorrectpassword}]" + havewebaccess + ".gif' border=0 align=middle>Online Update< /A > " ) ;
< /SCRIPT>

[color=navy]====================================[/color]

There.  That’s it.  I’m not sure all the code will come through successfully, and I added a space after every ‘<’ to display online here.  Be sure to remove them after a cut-and-paste.

You can find some other techniques and tools to help with these sort of things athttp://www.copperfieldpub.com, and there should be more there soon.

best –

roger
rnilsson@copperfieldpub.com

(Edited by Alaska at 2:38 am on Dec. 10, 2002)


Posted on: 9:53 pm on December 9, 2002
Alaska Ok, Robert needed some clarification, so I'm posting the simplified version here.

 Here is a small demo you can build yourself:  First, -

===================================
1. Make a text file called online.js.  paste this one line into the file:

havewebaccess = '1';


2. copy this online.js file to your website. (remember where you put it!)


3. Create an ebook page (just a local web page right now), called 'test.htm', paste this script into that page, changing the SRC to your domain and online.js file (wherever you put it).


< HTML>
< HEAD>

< SCRIPT LANGUAGE="JavaScript" >
  havewebaccess = '0'
< /SCRIPT>

< SCRIPT LANGUAGE="JavaScript" SRC="http://yourdomain.com/online.js">
< /SCRIPT>

< /HEAD>
< BODY>

< SCRIPT LANGUAGE="JavaScript">
document.write("< A HREF='online_update_" + havewebaccess + ".htm' >">Online Update< /A>" ) ;
< /SCRIPT>

< /BODY>
< /HTML>


4. Then, create two .html files called online_update_0.htm and online_update_1.htm:

  online_update_0.htm contains this:

   < html>< body>sorry, not online, or show your own series of built-in ads...< /body>< /html>


5. online_update_1.htm contains this:

  < html>< body>< iframe src="http://www.youronline_ad_campaign.com/ads.htm" width = "100%">< /iframe>< /body>< /html>


6.  Open 'test.htm' to see your online advertisement.   Then, disable your internet connection, and open the test.htm file again to see the 'not online' message.

=======================================

And that is a slim version of how its done.  For your ebook, you will want to call the ad into one of your frames.  (And, be sure to take out the extra spaces from the script, tucked in here just to keep the code from executing. )

best -

roger
rnilsson@copperfieldpub.com

(Edited by Alaska at 12:36 am on Dec. 11, 2002)


Posted on: 9:33 pm on December 10, 2002
Sly9er THAT was a totally worthless experiment.


Posted on: 1:10 pm on May 26, 2007

Go to Active Discussion Thread

Participate in Current/New Discussions

List All Archived Forums



Copyright © 2000-2015, 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.

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