Hey! Are you staying home? We are too. Still, we prepared a new product release for you!🚀

We hope it comes in handy for your business especially these days. Stay safe & pivot on!

Unable to open file 'Access-Control-Allow-Origin'

Answered

Hi all!
I uploaded all WebDataRocks js and css files to my domain my-site.it.
Starting from the basic example, I specified a different data file, located in the same domain, but I got the following error message: 
Unable to open file https://my-site.it/webdatarocks/data.csv?440294287.
It seems that this file doesn’t exist or ‘Access-Control-Allow-Origin’ header is absent in the resource requested.
I also get the same message if all files are saved in my PC or only csv data file is local (see index_csv_locale.html attached).
How to solve the problem?
Thank you in advance.

1 answer

WebDataRocks Team WebDataRocks April 1, 2020

Hello, Antonio,
 
We recommend checking out if the right path to the file is specified. An actual path that used when trying to find the file can be found in the console log of your browser where an appropriate exception appears.
Please note that the relative path will consider an HTML file where the JavaScript runs as a root folder.
 
Concerning files stored locally on your computer, we would like to kindly inform you that the browser does not have permissions to access them by default. In order to open such a file the user has to manually navigate and connect to them. It can be done using the Toolbar: hover over the “Connect” tab and choose an appropriate option from the drop-down menu. In case custom controls are required, we recommend getting on with connectTo and updateData methods provided by the component. The difference between them is that updateData allows saving the configuration of the pivot (set of fields chosen for the display, formatting, sorting, etc.) when the connectTo reset them to the default state after execution.
Setting their browseForFile parameter to true allows opening the file manager and navigation to the desired file. Please note that it is mandatory to specify the data type of the file as a value of the dataSourceType parameter of the methods:

pivot.updateData({
dataSourceType: "csv",
browseForFile: true
});

 
We hope it helps.
 
Do not hesitate to contact us in case of additional questions.
 
Best regards,
WebDataRocks Team

Please login or Register to Submit Answer