User e22d9561fc
20-06-2014 16:40:21
ChemAxon 7c2d26e5cf
23-06-2014 15:11:09
I have checked your example.
Indeed, sometimes the image does not display. In this case, you can find the following error message on the JavaScript console:
Uncaught TypeError: Cannot read property 'molToDataUrl' of undefined
The error is here in your code:
$(window).load(function() {
var settings = {};
var dataUrl = marvin.ImageExporter.molToDataUrl($("#molsource-box").val(), "image/png", settings);
In your example, the image generation is called immediately when page loading is finished. In this moment, there is no guaranty that marvin.ImageExporter is already ready.
Please, bind your code to the "ready" event of the "marvin" package instead of the load event of the browser.
marvin.onReady(function() {
var settings = {};
var dataUrl = marvin.ImageExporter.molToDataUrl($("#molsource-box").val(), "image/png", settings);
});
Please, see the following Marvin JS example where the above functionality is demonstrated:
Display More Images Immediately