> ## Documentation Index
> Fetch the complete documentation index at: https://docs.titanos.tv/llms.txt
> Use this file to discover all available pages before exploring further.

# Titan SDK with CDN

This guide explains how to integrate the Titan SDK into your project using the Content Delivery Network (CDN) URL method.

It's an alternative to the NPM method. This approach is ideal for simple projects, quick prototypes, or environments that do not use a build system with npm (like Vite or Webpack).

<Note>
  For modern and robust applications, we recommend using the [npm installation method](/titan-sdk), as it provides version management.
</Note>

## How to Use

CDN integration is straightforward and involves just two steps.

<Steps>
  <Step title="Add the Script to your HTML">
    To begin, add the following \<script> tag inside the \<head> tag of your main HTML file. Placing it in the \<head> ensures the SDK is loaded before any of your own scripts are executed.

    ```javascript theme={null}
    <script
    src="https://sdk.titanos.tv/sdk/sdk.js"
    type="text/javascript"
    ></script>
    ```
  </Step>

  <Step title="Access the Global TitanSDK Variable">
    After the script is loaded, it will create a global object named TitanSDK on the window object. You can access it directly in your JavaScript files to start using the SDK's functionalities.

    ```javascript theme={null}
    // The TitanSDK variable is now globally available
    const titanSDK = TitanSDK;

    console.log('Titan SDK has been loaded:', titanSDK);
    ```
  </Step>
</Steps>

## Usage Example

Here is a practical example of how to fetch device information using the CDN method. Note that, just like the npm version, function calls are asynchronous.

```javascript theme={null}
document.addEventListener('DOMContentLoaded', async () => {
  try {
    // 1. Access the global variable
    const titanSDK = TitanSDK;

    // 2. Call the function to get device information
    const deviceInfo = await titanSDK.deviceInfo.getDeviceInfo();
    
    // 3. Log the information to the console
    console.log('TV Brand:', deviceInfo.Product.brand);
    console.log('Model Year:', deviceInfo.Product.year);

  } catch (error) {
    console.error('Failed to use the Titan SDK:', error);
  }
});
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Introduction to Titan SDK" icon="rectangle-code" href="https://www.google.com/search?q=/titan-sdk">
    View the main documentation and the recommended npm installation method.
  </Card>

  <Card title="Migration Guide" icon="arrow-right-arrow-left" href="https://www.google.com/search?q=/migration-to-titan-sdk">
    Consult the detailed guide for migrating from the old DeviceInfo API.
  </Card>
</CardGroup>
