+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 16
Like Tree2Likes

Thread: Free Hosting Tricks #1

  1. #1
    cybrax's Avatar
    cybrax is offline x10 Elder cybrax is on a distinguished road
    Join Date
    Aug 2009
    Location
    UK
    Posts
    699

    Free Hosting Tricks #1

    Here is a little trick I came up with some time ago to compensate for flaky hosting, thankfully have not needed it for a while but some of you may find this useful for basic sites. However if you are heavily dependant on databases then it gets a lot more complicated as these may need to be synchronised periodically or even frequently if you have a forum or chatroom.


    How it Works:
    Basically you employ a Google Free Site as your main landing site, this runs a simple bit of javascript wrapped in XML. A quick check is performed to see if your actual site is up and running and if not performs a redirect to an alternate URL. This can either be a mirror copy of your site or just an error page, hosted on a different server/provider.

    The check to see if a domain is up and running is very basic, using a simple request for an image. Should this image request fail it sends an error back to the javascript that asks for that same image from the next mirror site in turn and so on till it finds a working server.

    When it finds one that works it then performs a redirect to the active host. Finally you need to add 'frame breakout' to the landing URL page in order to destroy the Google Site Iframe and hey presto your done.


    Here's the basic XML code to be attached to a google web site page, modify to suit.
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <Module>
    <ModulePrefs title="test1" />
    <Content type="html"><![CDATA[
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    
    
    <script type="text/javascript">
    
    var fields1="http://www.mySite_1/";                //primary site
    var fields2="http://www.mySite_2/";                //secondary 
    var fields3="http://www.mySite_3/";                //tertiary
    
    
    
    function redir1(com)
    {                                                   // read the command attribute
    if (com == 1)sp=0;                            // check primary & set status : 0 = offline
    if (com == 2)ss=0;                            // check secondary
    if (com == 3)st=0;                            // check tertiary
    
    
    
    
    if (com = "dump"){                                  // read the command attribute
    //
    winloc = fields1;                                     // sets default primary site
    if (sp == 0)winloc=fields2;                        // if primary offline redirect to secondary site 
    if (sp == 0 && ss == 0)winloc=fields3;        // if primary and secondary offline redirect to tertiary site 
    
    window.location= winloc;                    // perform redirect
    
    }// end dump
    
    }// eof
    
    </script>
    
    </head>
    
    <body>
    
    
    <img src="http://www.mySite_1/test.gif" onerror="redir1(1)">    <!-- primary site check -->
    
    <img src="http://www.mySite_2/test.gif"  onerror="redir1(2)">    <!-- secondary site check -->
    
    <img src="http://www.mySite_3/test.gif"  onerror="redir1(3)">    <!-- tertiary site check -->
    
    <script type="text/javascript">redir1(dump);</script>  <!-- initiate redirect  -->
    
    </body>
    </html>
    ]]></Content>
    </Module>
    Limitations:
    Google is of course just like any other web host and can suffer from outages themselves but for the most part are regarded as very stable and ideal for this purpose.
    The code must flow.
    Project 157: Latest UK Jobs direct to your mobile phone
    New Domain under construction: Lovelogic.net
    home for some new projects that we can't keep here ;)


  2. #2
    money_mashine33 is offline x10Hosting Member money_mashine33 is an unknown quantity at this point
    Join Date
    Oct 2010
    Posts
    31

    Re: Free Hosting Tricks #1

    Thanks, nice .

    Please more info, i am newbie. Where to upload this xml ??

  3. #3
    cybrax's Avatar
    cybrax is offline x10 Elder cybrax is on a distinguished road
    Join Date
    Aug 2009
    Location
    UK
    Posts
    699

    Re: Free Hosting Tricks #1

    Good question.

    Once you set up an account with Google and created your blank site.
    Open the page editor.. and find the big button marked 'More actions' (it's on the far right)

    More Actions -> Manage Site -> Attachments-> gives you the browse your PC for the upload


    Now go back and look for the tab marked insert (far left of screen) click this and long list of options appears. The one you want is all the way down at the bottom marked more gadgets... Click that and a new window appears in that is box marked add gadget by url
    this needs the full URL name of your site and the name of the XML gadget file eg: https://sites.google.com/site/smithjones/gadget.xml

    click OK and the gadget appears on your web page
    The code must flow.
    Project 157: Latest UK Jobs direct to your mobile phone
    New Domain under construction: Lovelogic.net
    home for some new projects that we can't keep here ;)


  4. #4
    money_mashine33 is offline x10Hosting Member money_mashine33 is an unknown quantity at this point
    Join Date
    Oct 2010
    Posts
    31

    Re: Free Hosting Tricks #1

    Thanks.

  5. #5
    ithanoicacid39 is offline x10Hosting Member ithanoicacid39 is an unknown quantity at this point
    Join Date
    Feb 2011
    Posts
    7

    Re: Free Hosting Tricks #1

    Thanks

  6. #6
    roby718 is offline x10Hosting Member roby718 is an unknown quantity at this point
    Join Date
    Sep 2009
    Posts
    53

    Re: Free Hosting Tricks #1

    That is an awesome method for determining availability.

  7. #7
    lidor_1a16 is offline x10Hosting Member lidor_1a16 is an unknown quantity at this point
    Join Date
    Nov 2010
    Posts
    6

    Re: Free Hosting Tricks #1

    ooo thank you gay...

  8. #8
    cybrax's Avatar
    cybrax is offline x10 Elder cybrax is on a distinguished road
    Join Date
    Aug 2009
    Location
    UK
    Posts
    699

    Exclamation Re: Free Hosting Tricks #1

    Coming soon.. Secure password protection using Javascript
    dinomirt96 and karimirt47 like this.
    The code must flow.
    Project 157: Latest UK Jobs direct to your mobile phone
    New Domain under construction: Lovelogic.net
    home for some new projects that we can't keep here ;)


  9. #9
    bltgamemasterx74 is offline x10Hosting Member bltgamemasterx74 is an unknown quantity at this point
    Join Date
    Aug 2010
    Posts
    43

    Re: Free Hosting Tricks #1

    Very nice tutorials! Helpful for some with bad or unreliable hosting!

  10. #10
    sankalpgarud98 is offline x10 Sophmore sankalpgarud98 is an unknown quantity at this point
    Join Date
    Feb 2011
    Posts
    107

    Re: Free Hosting Tricks #1

    Nice idea mate. Thoroughly appreciate your effort.
    Free hosting has its problems many a times, so such thing might help..
    anyways,
    cheers.
    Love to help
    visit http://adobewhatisit.x10.mx for free tutorials and articles.
    If you like to posts articles and help others, you are welcomed as well...

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Free mobile tricks for india
    By bajpatt in forum Computers & Technology
    Replies: 0
    Last Post: 05-09-2010, 09:12 AM
  2. Any tips and tricks
    By buddaman in forum Introductions
    Replies: 11
    Last Post: 04-29-2010, 06:30 PM
  3. Some known tricks
    By greeting in forum Computers & Technology
    Replies: 18
    Last Post: 07-17-2008, 01:17 PM
  4. PHP Tips and Tricks
    By frznmnky in forum Tutorials
    Replies: 5
    Last Post: 06-02-2008, 05:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers