How to delay custom code snippet execution in wix - delay

I have this code snippet:
<script type='text/javascript' src='//form.ravpage.co.il/b7ca64ace3056e1fe11b3e16d52e58035DFCB665' charset='UTF-8'></script>
I added it to tracking tools and analytics and I tried to delay it's load using setTimeout, but it didn't work out.
I would appreciate any help, Thanks!

Related

how to open javascript code after website load

my website loading time is too much for zendesk chat, when i remove zendesk chat the website loading time under 2 seconds
here is my zendesk code
<script>
window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s= d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set._.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute("charset","utf-8");$.src="//v2.zopim.com/?14mOH4BM2323DFADFSAS";z.t=+new Date;$.type="text/javascript";e.parentNode.insertBefore($,e)})(document,"script");
</script>
To combat this, a common practice is putting your scripts at the bottom of your body, so that the visual aspects of the website load first before the scripts.
For example:
<html>
<body>
<h1>My Website Contents</h1>
<script>console.log('My scripts go down here');</script>
</body>
</html>

How to run web components based HTML without node?

I was following the section "How do I use a web component?" from
What are web components?
end very soon I realized that node and npm it's a must. On top of that you have to run node to serve it.
Code
<html>
<head>
<script type="module" src="node_modules/#polymer/paper-button/paper-button.js"></script>
</head>
<body>
<paper-button raised class="indigo">raised</paper-button>
</body>
</html>
What is the simplest - no node - way to run this simple web component?
Disregard everything "Polymer",
better yet... burn it down, throw your coffee over every monitor you see that title.
It was based on the V0 implementation of Web Components;
which basically was Google's lets-throw-something-at-the-wall-and-see-if-other-vendors-adopt-it attempt at forcing Web Components on us.
That whole V0 era is what gave "Web Components" a bad reputation, and catchy blog titles like
"The Broken Promise of Web Components"
(but everyone involved learned what not to do)
Since years, all Browsers vendors work together on V1
Web Components run in all modern Browsers.. period.. so all you need is a Browser..
no built steps.. no bundlers.. no parcel.. no Svelte-compiler... no Rome... no fuss
Use any online editor like JSFiddle or CodePen, or your own IDE, or use your F12 Sources panel
and with a few lines of code you are started
<my-component name="Alex"></my-component>
<script>
customElements.define("my-component", class extends HTMLElement {
connectedCallback() {
this.innerHTML = `<h2>${this.getAttribute("name")} his very first Custom Element!</h2>`;
}
});
</script>
The 3 distinct (each can be used without the other) technologies making up "Web Components" help you built more complex Components
https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template
https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM
Soon you will read about Lit and Hybrids and Stencil and uCe, and all types of tools that make developing Web Components "easier"...
They are just that... tools; You pick one or two once you fully understand the technology
The simplest way would probably be to just include the script via a CDN like UNPKG https://unpkg.com/.
<html>
<head>
<script
type="module"
src="https://unpkg.com/#polymer/paper-button#3.0.1/paper-button.js?module"></script>
</head>
<body>
<paper-button raised class="indigo">raised</paper-button>
</body>
</html>

Additional resource/ js files added by Kentico?

I view sourced a site I built with Kentico (v9) and noticed there're many js files added (sample list below) that I've never used or added myself in any of my templates. Is there a place/file where I can manage this listing? One of the resource file returns a 404, and the jquery-core is redundant (because I used and linked to a different jquery file in the master template)
Edit: To clarify, I've created the site from scratch myself using Portal Engine, so I know which files are in use/needed, but the system was set up by a different team, so I'm not sure about those resources and how they got in there.
<script src="/WebResource.axd?d=tOC6-8tIvm-6k-UeWp5sUWPuNRu5mtP3WV2AZEfL9nI2sRmgKd5MnlDVvBjdzVe9wwB392nFnls5rAu3Ry5vq1yWL8h_-l2ltMTIVb8BU3E1&t=637346642097037378" type="text/javascript"></script>
<script src="/CMSPages/GetResource.ashx?scriptfile=%7e%2fCMSScripts%2fWebServiceCall.js" type="text/javascript"></script>
<script src="/CMSPages/GetResource.ashx?scriptfile=%7e%2fCMSScripts%2fRequireJS%2frequire.js" type="text/javascript"></script>
<script src="/CMSPages/GetResource.ashx?scriptfile=%7e%2fCMSScripts%2fRequireJS%2fconfig.js&resolvemacros=1" type="text/javascript"></script>
<script src="/CMSPages/GetResource.ashx?scriptfile=%7e%2fCMSScripts%2fcms.js" type="text/javascript"></script>
<script src="/CMSPages/GetResource.ashx?scriptfile=%7e%2fCMSScripts%2fjquery%2fjquery-core.js" type="text/javascript"></script>
Most of these are things added by various Controls (webparts), not much you can do about it, it's the nature of WebForms that in order for certain things to work it needs to pull in the javascript this way.

bootstrap full year calendar setup

I'm trying to get this package http://www.bootstrap-year-calendar.com up and running. I've got nodeJS installed, have grabbed the package with npm and have setup an html page as per the usage instructions, but I cannot actually get the calendar to render. This is my first foray into nodejs, so I suspect I'm missing something straightforward. Any ideas on what the problem might be?
Thanks as always. My html/js currently looks like this:
<html>
<head></head>
<body>
<script src="./jquery/dist/jquery.js"></script>
<script src="./bootstrap/dist/js/bootstrap.js"></script>
<script src="./bootstrap-year-calendar/js/bootstrap-year-calendar.min.js"></script>
<script>
$('.calendar').calendar()
</script>
</body>
</html>

javascript latest file not download in IE without cache clear

I have do to some changes in Javascript files. i deployed in my server and reset IIS.
I tried to launch from IE , the latest modified file changes cannot appear. It reads old file.
If I have to clear the cache , it will work. without clear cache how to work with latest files.
Please give a guidance to resolve this issue.
Thanks.
//try to get the value for time now and to add it to the script file url as version id
<html>
<title>
<script src='http://example.com/js/main.js?ver=<%=DateTime.Now.Ticks%>'
type='text/javascript' ></script>
<title>
<body>
</body>
</html>
You should check cache control options in your IIS.
For flushing cache you can use some variables in js links.
For example:
http://domain.com/js/main.js
and
http://domain.com/js/main.js?ver=1
downloads same file, but second link downloads file like new resource

Resources