Welcome to TalkGraphics.com
Page 3 of 3 FirstFirst 123
Results 21 to 22 of 22
  1. #21
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,895

    Default Re: Leveraging the Conventional Website

    No, not using the file in ernest, just trying your technique at present..

    Ernest say's will I leave him alone now.
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  2. #22
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,746

    Default Re: Leveraging the Conventional Website

    In the first Post, I mentioned an ASIDE about pre-loading all the images for a Conventional website.
    The point of this Thread was to see if the features in an A-site and a C-site could be delivered by a D-site solution.
    The development indicates mostly.

    Where these sites gain is in the speed of switching pages. The down side is the length of time the initial download takes until the site is fully functional as all the pages are bundled into the only HTML file.

    Working on the test file, and enabling WebP (95% of users' browsers can use WebP), I have found that I can defer the download of the remaining website WebP images until after the first-accessed page is ready.
    The same file as an A-site or D-site would download 1.5MB before being useable.
    The D-site is 500kB, with the remaining 1MB loading in the background and is usually complete before you have read the first sentence.
    Each page transition for the A-site or D-site is an additional 6kB of network traffic; the D-site (this approach) is near 11kB. Neither is significant and ultimately the page change is no different to a viewer in bandwidth delay.

    If you are checking with Xara's Preview, you will not see any caching as Xara enables a no-cache rule.

    The code is in the Website section.
    The head has an additional two lines to get a list of WebP images used in the website.
    Code:
      images = asite.replaceAll('\r', '').split('\n').filter(x => x.search(/\.webp/) > 0 );
      images = [...new Set(images)];
    The body has a new function that is clled after a short delay:
    Code:
    function preloadImages(array) {  if (!preloadImages.list) {
        preloadImages.list = [];
      }
      var list = preloadImages.list;
      for (var i = 0; i < array.length; i++) {
        var img = new Image();
        img.onload = function() {
          var index = list.indexOf(this);
          if (index !== -1) {
            list.splice(index, 1);
          }
        }
        list.push(img);
        img.src = array[i];
      }
    }
    
    
    setTimeout(function(){ preloadImages(images); }, 320);
    In the test file I set the delay to 160mS; you need to trial the value best met by your service provider and expected download speed for getting the xr_files.txt file.

    The Ultimate Conventional Website - Step 9.xar

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

 

 

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •