Use Github together with HTML Component in Wix (Video)

I just published a small tutorial how I use a Github repo to edit and work with HTML Component code in Visual Studio Code.

Happy coding!

#github #htmlcomponent

5 Likes

Freakin’ awesome Andreas! This could be very useful. Gotta find a way around the cache issue.

What? Should be drinking red wine??? I’ll have a beer instead.

2 Likes

Hey Andreas,

Not sure it will help in an iFrame (HtmlComponent), but since you already have this mechanism in place, maybe you can give this a quick try.

These meta tags are supposed to force clearing the cache:

<meta http-equiv=“Pragma” content=”no-cache”>
<meta http-equiv=“Expires” content=”-1″>
<meta http-equiv=“CACHE-CONTROL” content=”NO-CACHE”>

Let us know if one of these works.

I’m going to set this up for myself when I get a chance.

I have tried all kinds of meta tags to prevent caching from happening but it seem like a problem that is not possible to solve using meta tags.

I was thinking of is the meta refresh trick would be usable and trying to add a random number to the url of self.location maybe? Will update you if it works.

Hey @yisrael-wix !
So by adding some smart Javascript code I can now get around the caching of the content. I do not know if this is actually a good approach in production environments.

<html>
 <head>
 <script type="text/javascript">
 window.onload = setupRefresh;
 
 var randomUrlToAppend = (Date.now() + Math.random()).toString();
 function setupRefresh() {
 setTimeout("refreshPage();", 500); // milliseconds
         }
 function refreshPage() {
 window.location = location.href + "?cacheKiller=" + randomUrlToAppend;
         }
 </script>
 </head>
 <body>
 <h1>wixshow.com </h1>
 <p>just updated this page, <code>v2.6</code> javascript refresh method</p>
 
 </body>
</html>

By using Javascript to actually refresh the page after n milliseconds and also adding a random string to the url the cache is overridden and the content is reloaded fresh and updated.

@andreas-kviby Don’t worry about production environments. Your Github technique wouldn’t be used in production in any case. The main idea is that the developer won’t have problems with cache during development - like you did during the video.

BTW - Take a Nobel prize out of petty cash.

1 Like