If you've downloaded the Syncfusion CDN files and moved them to your local project directory, and then linked them using relative paths like ~/lib/syncfusion/css/material.css, you might encounter issues related to path resolution. Here are some troubleshooting steps and tips to ensure everything works properly:
1. Correct Path Resolution
The tilde ~ symbol is often used in frameworks like ASP.NET to denote the root directory of the application but may not resolve correctly in regular HTML files. Try using a relative or absolute path without the tilde.
For example, if you have the following directory structure:
/your-project
│
├── /lib
│ └── /syncfusion
│ ├── /css
│ │ └── material.css
│ └── /scripts
│ └── ej2.min.js
└── index.html (or your main HTML file)
You would include the CSS and JS like this:
<link rel="stylesheet" href="lib/syncfusion/css/material.css" />
<script src="lib/syncfusion/scripts/ej2.min.js"></script>
2. Verify File Locations
Make sure that the files are indeed located in the specified directories. You can navigate to the directories using your file explorer to confirm that both material.css and ej2.min.js exist in the locations you specified.
3. Check the Console for Errors
Open the browser's developer tools (usually F12), and check the Console and Network tabs for any errors. If the files cannot be found, the Network tab will show 404 errors for those resources.
4. Use a Local Web Server
If you are just opening the HTML file directly in the browser (using file:// paths), some browsers have security measures that prevent local files from accessing each other correctly. It's better to run a local server. You can use simple servers like:
5. Clear Browser Cache
Sometimes, browsers cache older versions of files. Performing a hard refresh (Ctrl + F5 or Cmd + Shift + R) can help clear this cache.
6. Check for CORS Issues
If you're using AJAX calls post loading the JavaScript file and accessing external resources, ensure that you are not running into CORS errors due to browser limitations.
7. Example Structure and HTML
Here’s an example structure and the basic HTML:
Folder Structure:
/your-project
│
├── /lib
│ └── /syncfusion
│ ├── /css
│ │ └── material.css
│ └── /scripts
│ └── ej2.min.js
└── index.html
index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="lib/syncfusion/css/material.css" />
<title>Syncfusion Test</title>
</head>
<body>
<!-- Your HTML content here -->
<script src="lib/syncfusion/scripts/ej2.min.js"></script>
<script>
// Your initialization code using Syncfusion components
</script>
</body>
</html>
By following the above steps and ensuring the correct paths and serving method, you should be able to successfully load the local Syncfusion files. Let me know if you need any further assistance!