I’ve been testing with your solution and other code I had already and although I find yours shaves around 500ms from the loading time, I do not understand what is going on…
I assumed that it deferred the loading of the rates until the visitor entered some values in the widget, but then what is being loaded?
The saving in time is good news, but what I was looking for was a way of NOT downloading any data unless it was requested by the visitor at a later time, as it is very unlikely that 1% of my visitors would use it anyway. So, all I need is for the widget to show (internal html/css) and get the code to import, only if necessary, the data.
The fact that the WebConsole shows some sort of download from FX-rate leaves me confused.
That solution does not prevent widget loading, but moves it to the end of queue so your page will not “freeze” on that widget during loading. If you want to load widget “on demand” then you should consider using more tricky solution, like the one from post #5.
There are many extensions for any browser to make and crop screenshots of the page.
Also, that picture doesn’t have to be screenshot exactly, it could look like a banner “Click here to use currency converter” or something like that. It’s up to you completely.
In your code you designed a simple squarish box to act as a widget frame. I guess that what I need to do is to substiture that css code of yours by the one I already have for the widget, from which I got the screen shot.
Next, I cannot understand why when I clicj on this test page I get dollars when I changed your script to a different currency pair EUR/GBP