copy a folder and a JavaScript file to the root directory of your Wix website
0
4
0
To copy a folder and a JavaScript file to the root directory of your Wix website, you can follow these steps:
Access Your Wix Editor:
Log in to your Wix account.
Open your website in the Wix Editor.
Add JavaScript File:
Go to the Dev Mode by enabling Velo (formerly known as Corvid) if it’s not already enabled. You can do this by clicking on the Dev Mode button at the top of the Wix Editor.
Once Velo is enabled, you will see a Code Files panel on the left side of the editor.
Right-click in the Code Files panel and select New File.
Name your JavaScript file (e.g., myscript.js).
Paste your JavaScript code into this new file and save it.
Upload Folder to Site Files:
In the Site Structure sidebar, go to the Public folder. This is where you can upload files that need to be accessed publicly.
Click the Upload Files button to upload your entire folder. Note that Wix doesn't support direct uploading of folders, so you need to upload each file individually or as a compressed ZIP file.
If you upload a ZIP file, you need to unzip it on your local machine and upload the unzipped files one by one to the desired location.
Accessing Files:
Files uploaded to the Public folder can be accessed via URL. For example, if you uploaded a file named example.js to the root of the Public folder, you can access it at https://yourdomain.com/public/example.js.
Linking JavaScript File:
To link your JavaScript file to your site, you can add the following script tag in your site’s head section or in a specific page:<script src="https://yourdomain.com/public/myscript.js"></script>
You can add this script tag using the Velo code or by directly adding it in the Page Code section.
Example of Adding Script Tag Using Velo
Go to the Page Code section (accessible from the bottom of the page in Dev Mode).
Add the following code to the onReady function:$w.onReady(function () { const script = document.createElement("script"); script.src = "https://yourdomain.com/public/myscript.js"; document.head.appendChild(script); });
By following these steps, you can copy and use your folder and JavaScript file in the root directory of your Wix website. If you need more specific instructions or have any issues, please let me know!