-
milkod2001Asked on February 26, 2016 at 5:31 AM
HI guys,
First of all, your jot forms are really amazing-piece of art.
Im trying to implement one the my forms i have created on WordPress and i want to find out what are the best practices to do so.
Form is working BUT(im getting this dform GT metrix):
462.1KiB of JavaScript is parsed during initial page load. Defer parsing JavaScript to reduce blocking of page rendering.
https://cdn.jotfor.ms/static/jotform.forms.js?3.3.11553 (238.9KiB) https://cdn.jotfor.ms/static/prototype.forms.js (115.0KiB)etc etc
I have link on home page for my form, form is only visible when clicked on it BUT all javascripts are loaded when home
page is loading and that unnecessary slows down website.
Form is implemented with iframe. That was only way how it worked.
My question is: IS there any way i can setup iframe to load only when is needed(when someone will click on link for form)?
Or is there any way how can i minimize the size of scripts which are coming with form. My form has only 2 fields to fill and submit part . Over 353kb feels like awful load for that little im getting.
Please help me with this.
Thanks
Page URL: http://www.michaelmurphy.ie/ -
mert JotForm UI DeveloperReplied on February 26, 2016 at 8:58 AM
Hi there,
If you embed the the whole iFrame embed code currently, we shorten its length and size by deleting the unnecessary script part. As it is seen from the below, you don't need to take the whole structure of the embed code, the content between <iframe>...</iframe> tags is enough to embed your form. (Following code is just an example, please don't embed that one.)
<iframe
id="JotFormIFrame"
onDISABLEDload="window.parent.scrollTo(0,0)"
allowtransparency="true"
src="https://form.jotform.com/53341292355958"
frameborder="0"
style="width:100%;
height:800px;
border:none;"
scrolling="no">
</iframe>
Please, try this method, it will optimize the page load times and also, don't forget to let us know the results.
Thanks.
-
milkod2001Replied on February 26, 2016 at 9:20 AM
Hi Mert,
I have only used what was sitting within iframe, implemented it, updated files, tested it again and the results are actually the very same:
461.0KiB of JavaScript is parsed during initial page load. Defer parsing JavaScript to reduce blocking of page rendering.
https://cdn.jotfor.ms/static/jotform.forms.js?3.3.11559 (238.9KiB) https://cdn.jotfor.ms/static/prototype.forms.js (115.0KiB) etc etc.I could live with 350kib of java scripts but i would like those scripts to load on website only if form is called for.
Currently it is only a link, it only display pop up window with form when clicked on this link. But it loads when page is loaded which unnecessary slow down website. Is there any way in iframe to tell it to load script only when needed/clicked on link?
Thanks
-
mert JotForm UI DeveloperReplied on February 26, 2016 at 10:14 AM
According to my last searches, you can put your iFrame into a button and it start to work only on button click. Please, check the related page from the link below:
http://stackoverflow.com/questions/26285955/how-to-display-an-iframe-on-button-click
In addition to this, you can try to embed your form by using the default script embed code as it is mentioned on the guide about how to embed your code to Wordpress:
For .Org,
http://www.jotform.com/help/4-Adding-Forms-to-Wordpress-org-version
For.Com,
http://www.jotform.com/help/299-How-to-Embed-Form-to-Wordpress-com
-
milkod2001Replied on February 26, 2016 at 11:18 AM
Thanks, i will give a stackoverflow solution a try
-
mert JotForm UI DeveloperReplied on February 26, 2016 at 11:24 AM
You are kindly welcome. Please, don't forget to let us know about the results.
Regards.
-
milkod2001Replied on February 26, 2016 at 11:25 AM
Will do
-
computeroverhaulsReplied on February 28, 2017 at 2:23 PM
-
John_BensonReplied on February 28, 2017 at 4:06 PM
@computeroverhauls
In order for us to properly assist you, I have moved your question to a new thread. Please wait for our reply on this thread URL: https://www.jotform.com/answers/1078401
Thank you.