

{"id":593,"date":"2026-07-29T17:13:43","date_gmt":"2026-07-29T17:13:43","guid":{"rendered":"https:\/\/apropostechsolutionscorp.ca\/blog\/?p=593"},"modified":"2026-07-29T17:13:43","modified_gmt":"2026-07-29T17:13:43","slug":"javascript-defer","status":"publish","type":"post","link":"https:\/\/apropostechsolutionscorp.ca\/blog\/2026\/07\/29\/javascript-defer\/","title":{"rendered":"JavaScript: defer"},"content":{"rendered":"\n<h3>Getting JavaScript to load when a webpage loads can be a consideration.<\/h3>\n<p>\nThe following is by my understanding.<\/p>\n<p>\nLately I&#8217;ve been doing a lot of hands-on, physical tasks, as my posts have reflected. However, yesterday I had to incorporate some JavaScript into a web page. I&#8217;d done so many times in the past, but wondered if I&#8217;d done so the best way, if there&#8217;s a better way now, etc. I decided to look it up.<\/p>\n<p>\nI discovered that a way to load JavaScript after the web page loads seems to be to put <span style=\"color:green\">defer<\/span> in the script tag where the JavaScript source is given: something like this:<\/p>\n<p>\n&lt;script src=&#8221;script.js&#8221; defer&gt;&lt;\/script&gt;<\/p>\n<p>\nIt seemed to work great.<\/p>\n<p>\nSource:<\/p>\n<p>\n<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/HTMLScriptElement\/defer\">developer.mozilla.org<\/a><\/p>\n<p><a href=\"https:\/\/apropostechsolutionscorp.ca\">-js<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Getting JavaScript to load when a webpage loads can be a consideration. The following is by my understanding. Lately I&#8217;ve been doing a lot of hands-on, physical tasks, as my posts have reflected. However, yesterday I had to incorporate some JavaScript into a web page. I&#8217;d done so many times in the past, but wondered [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[79],"tags":[155,156,157],"class_list":["post-593","post","type-post","status-publish","format-standard","hentry","category-programming","tag-defer","tag-javascript","tag-load-script"],"_links":{"self":[{"href":"https:\/\/apropostechsolutionscorp.ca\/blog\/wp-json\/wp\/v2\/posts\/593","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/apropostechsolutionscorp.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/apropostechsolutionscorp.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/apropostechsolutionscorp.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/apropostechsolutionscorp.ca\/blog\/wp-json\/wp\/v2\/comments?post=593"}],"version-history":[{"count":3,"href":"https:\/\/apropostechsolutionscorp.ca\/blog\/wp-json\/wp\/v2\/posts\/593\/revisions"}],"predecessor-version":[{"id":596,"href":"https:\/\/apropostechsolutionscorp.ca\/blog\/wp-json\/wp\/v2\/posts\/593\/revisions\/596"}],"wp:attachment":[{"href":"https:\/\/apropostechsolutionscorp.ca\/blog\/wp-json\/wp\/v2\/media?parent=593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/apropostechsolutionscorp.ca\/blog\/wp-json\/wp\/v2\/categories?post=593"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/apropostechsolutionscorp.ca\/blog\/wp-json\/wp\/v2\/tags?post=593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}