Embed Widget
Quick Start
Basic Implementation
<iframe src="https://www.blockend.com/embedwidget?integratorId=YOUR_INTEGRATOR_ID" width="100%" height="600px" frameborder="0"> </iframe>React Implementation
import React, { useEffect, useState, useRef } from "react";
function BlockendWidget() {
const [height, setHeight] = useState(0);
const iframeRef = useRef(null);
useEffect(() => {
const handleMessage = (event) => {
if (event.data.type === "BLOCKEND_HEIGHT_UPDATE") {
setHeight(event.data.height);
}
};
window.addEventListener("message", handleMessage);
return () => window.removeEventListener("message", handleMessage);
}, []);
useEffect(() => {
// Request for the widget height
window.postMessage(
{
type: "BLOCKEND_REQUEST_HEIGHT",
},
"*"
);
}, []);
return <iframe ref={iframeRef} src="https://www.blockend.com/embedwidget?integratorId=YOUR_INTEGRATOR_ID" width="100%" height={height} style={{ border: "none" }} />;
}URL Parameters
Available Parameters
Parameter
Type
Description
Example
URL Example
PostMessage API
Message Types
Received Messages
Complete Implementation Example
React Component with Full Features
Vanilla JavaScript Implementation
Best Practices
1. Security Considerations
2. Performance Optimization
3. Error Handling
Last updated