Accessing Resource Files from a WebVI
- Updated2023-02-17
- 2 minute(s) read
Accessing Resource Files from a WebVI
You can include CSS, JavaScript, images, and other types of files in your web application and access them from a WebVI.
Note For information about including JavaScript files for a JavaScript Library Interface document, refer to the Integrating a JavaScript File Into a Web Application help topic.
-
In the
Project Files tab, right-click the application document file (.gcomp) and select
Import files.
Note You must save the application document before you can import files.
- Navigate to the file you want to add and click Open.
-
Open the WebVI you want to reference the resource file from, and choose one of the following options based on file type.
Type of file How to reference the file from your WebVI CSS In the <head></head> tags, add the following lines of code:
<link rel="stylesheet" href="my-style-sheet.css" />
Refer to the Mozilla Developer Network for more information on using CSS to customize the appearance of your UI.
JavaScript In the <head></head> tags, add the following lines of code:
<script src="my-script.js"></script>
Refer to the Mozilla Developer Network for more information on using JavaScript to add custom functionality to your web application.
Image - For images that are hosted externally, complete the following steps:
- Switch to the panel and add a URL Image control to the panel.
- On the Item tab, enter the path to your image file in the Source URL field.
- For images on disk, complete the following steps:
- Import the image into your application document file (.gcomp).
- Switch to the panel and drag the image from the Project Files tab onto the Panel.
- For images that are hosted externally, complete the following steps:
Related Information
- Integrating a JavaScript File Into a Web Application
Connect a JavaScript file to your web application and call functions you defined in a JavaScript Library Interface (JSLI) in your web application.