JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Data Grid › getting JSON codepen example to work with CORS issue
- This topic has 4 replies, 2 voices, and was last updated 1 year, 2 months ago by edwardsmarkff.
-
AuthorPosts
-
August 15, 2023 at 4:27 pm #108538edwardsmarkffParticipant
hello all –
grid newbie here. so far it looks mind-blowingly awesome!
i think the best way to get the https://www.htmlelements.com/demos/grid/datagrid-bind-to-json/ demo to work is to do the following:
- on windows, do window-key “R”
- enter the following command & open up a new window: chrome.exe –user-data-dir=”C://Chrome dev session” –disable-web-security
- click the “Edit the codepen” button at the bottom
- QUICKLY grab the URL to the codepen (it will morph after a moment or so)
- paste URL into the newly opened window from prior step
- change the dataSource value to the following: dataSource: ‘//htmlelements.com/demos/scripts/beverages.json‘,
there is an easy way to bypass the CORS issue by right-clicking the little lock just left of the URL and change “site-settings” to “allow insecure content” but i could not get that working with codepen.
- This topic was modified 1 year, 2 months ago by edwardsmarkff.
- This topic was modified 1 year, 2 months ago by edwardsmarkff.
- This topic was modified 1 year, 2 months ago by edwardsmarkff.
August 15, 2023 at 9:38 pm #108550edwardsmarkffParticipantsorry should have said:
- visit: https://www.htmlelements.com/demos/grid/datagrid-bind-to-json/
- scroll to bottom of page and notice the “Edit the codepen” button at the bottom of the page
- on windows, do window-key “R”
- enter the following command & open up a new window: chrome.exe –user-data-dir=”C://Chrome dev session” –disable-web-security
- go back to first window, and click “Edit the codepen” at the bottom of the page
- QUICKLY grab the URL to the codepen (it will morph into another URL after a moment or so) repeat if necessary
- paste URL into the newly opened window from step 4
- change the dataSource value to the following: dataSource: ‘//htmlelements.com/demos/scripts/beverages.json‘,
otherwise you get the CORS error.
August 18, 2023 at 4:56 pm #108583edwardsmarkffParticipantthis is starting to become a big problem with all the codepen examples:
Access to script at 'https://codepen.io/source/modules/smart.grid.js' (redirected from 'https://cdpn.io/source/modules/smart.grid.js') from origin 'https://cdpn.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
- This reply was modified 1 year, 2 months ago by edwardsmarkff.
- This reply was modified 1 year, 2 months ago by edwardsmarkff.
August 20, 2023 at 8:51 am #108598MarkovKeymasterHi,
It would not be possible to bypass CORS with codepen. All examples are also included in the download package.
Regards,
MarkovAugust 21, 2023 at 5:06 pm #108611edwardsmarkffParticipantActually, my suggestion works fine.
sadly, there is not a chrome plugin to do this for us, or at least not one i could find that works.
i should think simulating this with a plugin would be easy: chrome.exe –user-data-dir=”C://Chrome dev session” –disable-web-security
-
AuthorPosts
- You must be logged in to reply to this topic.