I have downloaded JxBrowser since I wanted to implement it in my e-Assessment application which I have developed in Java Swing for school students. I am however facing a problem. One of the controls that I have is HTML Canvas through which I allow students to draw diagrams which are auto saved after every few seconds(I am using wpaint.js for this). I was able to conveniently extract the image data from the canvas previously when I was using Java FXBrowser, however, ever since I am using JxBrowser, I am not able to get the image data, instead, I am getting the following exception.
Failed to execute ‘toDataURL’ on ‘HTMLCanvasElement’: Tainted canvases may not be exported.
The image resides on the local system and is part of the question that the student has to attempt. I believe this has something to do with cross origin restriction. However, there is no cross domain request in this case since both the application and the image are part of the same application and are accessed locally. (The student cannot manually select the image since it is part of the test paper and has to be automatically fed into the canvas and also automatically saved. I require the image data for auto saving which I am not getting because of the exception mentioned above.). Please help, I am stuck at this point.
I finally resolved it. Disabled the same-origin policy by entering the following chromium switch before creating my first Browser instance
Thanks to JxBrowser support team which was very prompt in helping me in this.