Skip to content

Conversation

@xingyaoww
Copy link
Contributor

Description

This PR adds support for loading trajectory files via URL parameters, making it easier to share and embed trajectories in other applications.

Features Added

  • Added support for loading trajectory files via a fileUrl URL parameter
  • Implemented error handling and CORS support for fetching external files
  • Added a fallback to use a CORS proxy when direct fetching fails
  • Created a processTrajectoryData function to handle different trajectory formats
  • Added support for embedding trajectory data directly in the URL using a data parameter with base64 encoding
  • Updated README.md to document the new URL parameter features

Testing

  • Created test-url-loading.html for testing both URL parameter and base64 data parameter loading
  • Created sample-url-trajectory.json for testing the URL parameter feature
  • Manually tested both methods and verified they work correctly

Use Cases

  1. Sharing trajectories: Users can now share trajectories by simply sharing a URL with the fileUrl parameter
  2. Embedding in other applications: The visualizer can be embedded in other applications with pre-loaded data
  3. Loading from GitHub Gists: Trajectories hosted in GitHub Gists can be loaded directly
  4. Loading from public storage: Trajectories stored in public storage services can be loaded directly

Example Usage

# Loading from URL
https://trajectory-visualizer.example.com/?fileUrl=https://example.com/path/to/trajectory.json

# Embedding data directly (base64 encoded)
https://trajectory-visualizer.example.com/?data=eyJoaXN0b3J5IjpbLi4uXX0=

@vercel
Copy link

vercel bot commented Aug 5, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
trajectory-visualizer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 5, 2025 6:14pm

@xingyaoww xingyaoww marked this pull request as ready for review August 5, 2025 18:18
@xingyaoww xingyaoww merged commit 106ce82 into main Aug 5, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants