Version 2.0.0 brings a major refactor from vanilla HTML/JS to React + TypeScript, with production-ready backend integration and improved architecture.
| Aspect | V1 | V2 |
|---|---|---|
| Framework | Vanilla JS | React + TypeScript |
| Architecture | Single HTML file + scripts | Component-based + engine class |
| Type Safety | None | Full TypeScript interfaces |
| Backend | None (analytics only) | Spring Boot scaffold included |
| Code Organization | Inline functions | Modular, reusable components |
| Maintainability | Manual DOM manipulation | React state management |
| React Ready | Blueprint only | Production component |
All V1 features are preserved in V2:
β
10+ loading modes (direct, paths, query, UTM)
β
Custom headers (X-Tracking-ID, X-Source, X-Campaign)
β
SHA-256 parameter encryption
β
Dynamic iframe resizing with aspect ratio lock
β
Analytics queue with exponential backoff retry (5 max)
β
Settings persistence (localStorage)
β
API key injection (multiple formats)
β
Advanced visual options (zoom, border, sandbox, scrolling)
β
YAML config + presets
// V1: Vanilla functions
function loadSite() { ... }
function buildUrl() { ... }
// V2: Component-based
<IframeLoader /> // Single drop-in componentBenefits:
- Reusable across projects
- State management built-in
- Composable with other React apps
- Hot reload support
// V2: Fully typed engine
class IframeLoaderEngine {
async buildUrl(config: IframeLoaderState): Promise<string>
async flushQueue(endpoint: string): Promise<void>
enqueueEvent(eventType: string, data: Record<string, unknown>): void
}Benefits:
- Type hints in IDE
- Compile-time error checking
- Self-documenting code
- Better for teams
interface IframeLoaderState {
siteUrl: string;
mode: string;
headers: HeaderConfig;
utm: UTMConfig;
resize: ResizeConfig;
visual: VisualConfig;
// ... more
}All configuration objects are fully typed β no guessing required.
@SpringBootApplication
public class BackendApplication {
// Ready for extending with:
// - REST endpoints for analytics
// - User authentication
// - Iframe policy management
// - Event logging
}V2 includes a basic Spring Boot scaffold for building production backends.
V1:
βββ index.html (everything in one file)
βββ styles.css
βββ script.js
βββ utils.js
V2:
βββ App (1).tsx (React entry point)
βββ IframeLoader.tsx (main component)
βββ app.tsx (TypeScript engine + interfaces)
βββ utils.js (shared helpers)
βββ styles.css
βββ BackendApplication.java (Spring Boot)
βββ yml.yml (config presets)
V2 exports IframeLoaderEngine as a standalone class that can be used outside React:
import { IframeLoaderEngine, defaultState } from './app';
const engine = new IframeLoaderEngine();
const url = await engine.buildUrl(config);
await engine.flushQueue('https://your-analytics.com/events');Perfect for:
- Next.js / Vue / Angular
- Node.js backends
- CLI tools
- Testing
# V1: Open index.html directly
open index.html
# V2: Use as React component
npm install
npm start// V1: Blueprint only
export type { IframeLoaderState }
// V2: Full implementation ready to use
import IframeLoaderEngine from './app';
const engine = new IframeLoaderEngine();// V2: Drop-in component
import IframeLoader from './IframeLoader';
function MyApp() {
return (
<div>
<h1>My App</h1>
<IframeLoader /> // Just add this
</div>
);
}None. β¨
All URL building logic, analytics, and encryption work identically between V1 and V2. The internal implementation is the same β just reorganized.
If you were using the V1 vanilla JS directly, the API contract is preserved:
- Same config object shape
- Same event queue behavior
- Same URL output
- Same localStorage keys
V1:
<!-- Fill form, click "Load Site" button -->V2:
import IframeLoader from './IframeLoader';
function App() {
return <IframeLoader />;
}Same UI, cleaner code.
V1:
async function buildUrl(config) {
let url = config.siteUrl;
if (config.mode === "pathEmbed") {
url = url + "/embed";
}
// ... etc
}V2:
import { IframeLoaderEngine } from './app';
const engine = new IframeLoaderEngine();
const url = await engine.buildUrl(config);Same logic, better organization.
V1 & V2 (identical):
engine.enqueueEvent('page_viewed', { url: 'example.com' });
engine.flushQueue('https://analytics.example.com/events');No changes needed.
V2 localStorage keys are identical to V1:
// Both V1 and V2 use:
localStorage.getItem('iframeLoaderSettings')
// Same object shape:
{
siteUrl: "example.com",
mode: "direct",
utm: { ... },
// ... etc
}Migrate from V1 to V2 and your saved settings load automatically. β
V1: Vanilla JS β direct DOM manipulation
V2: React β virtual DOM diffing, optimal updates
For a single iframe loader, performance is identical. React overhead is negligible at this scale.
import { IframeLoaderEngine, defaultState } from './app';
const engine = new IframeLoaderEngine();
const config = { ...defaultState, siteUrl: 'github.com' };
const url = await engine.buildUrl(config);
console.log(url); // https://gh.wkk.suimport IframeLoader from './IframeLoader';
export function CustomIframeLoader() {
return (
<div className="my-custom-wrapper">
<IframeLoader />
</div>
);
}import dynamic from 'next/dynamic';
const IframeLoader = dynamic(() => import('./IframeLoader'), {
ssr: false // Client-side only
});
export default IframeLoader;V2 Includes:
- β
React component (
IframeLoader.tsx) - β
TypeScript engine + full interfaces (
app.tsx) - β
Spring Boot backend scaffold (
BackendApplication.java) - β
Same HTML UI, styled as before (
index.html,styles.css) - β
Utility helpers (
utils.js) - β
Config presets (
yml.yml) - β
React entry point (
App (1).tsx)
All in one package. Pick and use what you need.
| Version | Type | Major Changes |
|---|---|---|
| V1 | Vanilla JS | Initial release, full-featured |
| V2 | React + TypeScript | Component refactor, type safety, backend scaffold |
- If you're building a React app: Yes. Use V2 component directly.
- If you're using V1 as a standalone HTML file: No need. V1 works great.
- If you want TypeScript: Yes. V2 has full types.
- If you want a backend: Yes. V2 includes Spring Boot scaffold.
Yes. localStorage keys are identical.
Yes. Import IframeLoaderEngine and use it anywhere (Node, CLI, vanilla JS).
V1 is feature-complete and stable. V2 is the new direction for React projects.
# Clone/download V2 files
cd dadvanceloader-v2
# Install dependencies
npm install
# Start dev server
npm start
# Opens http://localhost:3000 with IframeLoader componentSame features. Better code. Ready for teams.