");
- const [css, setCss] = useState("body{font-family:system-ui;padding:16px}\niframe, img{max-width:100%}");
- const [js, setJs] = useState("console.log('Viewer ready');");
+ const [html, setHtml] = useState(DEFAULT_HTML);
+ const [css, setCss] = useState(DEFAULT_CSS);
+ const [js, setJs] = useState(DEFAULT_JS);
+
+ const fileInputRef = useRef(null);
+
+ const editorValue =
+ activeTab === "html" ? html : activeTab === "css" ? css : js;
+ const setEditorValue =
+ activeTab === "html" ? setHtml : activeTab === "css" ? setCss : setJs;
+
+ const tabLabel =
+ activeTab === "html"
+ ? "HTML"
+ : activeTab === "css"
+ ? "CSS"
+ : "JavaScript";
+
+ const fileAccept =
+ activeTab === "html" ? ".html,.htm,.txt,text/html" : "text/plain,.css,.js";
+
+ const buildDocument = () => {
+ return `\nPreview${html}',
+ example_string_description:
+ 'If you preview untrusted SVGs, always treat them like HTML: sanitize before rendering. This SVG Viewer removes common unsafe elements before previewing.',
+ info_items: [
+ {
+ part: 'Scripts:',
+ description: 'Script tags can run code in some contexts and should be removed.',
+ },
+ {
+ part: 'Event handlers:',
+ description: 'Attributes like onload/onclick can execute JavaScript and should be stripped.',
+ },
+ {
+ part: 'foreignObject:',
+ description:
+ 'foreignObject can embed HTML inside SVG, which increases XSS risk when rendering untrusted content.',
+ },
+ ],
+ },
+ development_tools_what: {
+ about_title: 'What does the SVG Viewer do?',
+ what_description: [
+ {
+ descriptions:
+ 'The SVG Viewer lets you paste SVG markup or upload an SVG file and instantly see a live preview in your browser.',
+ },
+ {
+ descriptions:
+ 'It detects and displays common SVG attributes like width, height, and viewBox to help you troubleshoot sizing, alignment, and cropping issues.',
+ },
+ {
+ descriptions:
+ 'For safer previews, the tool sanitizes the SVG before rendering by removing scripts and foreignObject content and stripping inline event handlers.',
+ },
+ ],
+ },
+ development_tools_steps_guide: {
+ guide_title: 'How to use the SVG Viewer?',
+ guide_description: 'Follow these steps:',
+ steps: [
+ {
+ step_key: 'Step 1:',
+ step_title: 'Paste or upload:',
+ step_description:
+ 'Paste SVG markup into the editor or upload an .svg file to load its content.',
+ },
+ {
+ step_key: 'Step 2:',
+ step_title: 'Preview:',
+ step_description:
+ 'See the rendered SVG immediately in the preview panel (scripts and foreignObject are removed).',
+ },
+ {
+ step_key: 'Step 3:',
+ step_title: 'Inspect attributes:',
+ step_description:
+ 'Copy basic info such as width, height, and viewBox to debug scaling issues.',
+ },
+ {
+ step_key: 'Step 4:',
+ step_title: 'Copy or download:',
+ step_description:
+ 'Copy the sanitized SVG markup or download it as a .svg file.',
+ },
+ ],
+ },
+ development_tools_how_use: {
+ how_use_title: 'Common use cases for SVG Viewer',
+ how_use_description: 'Popular reasons to use this tool:',
+ point: [
+ {
+ title: 'Debugging scaling and alignment',
+ description:
+ 'Quickly check viewBox/size attributes when an SVG looks stretched, clipped, or misaligned in a UI.',
+ },
+ {
+ title: 'Previewing icons from tickets/PRs',
+ description:
+ 'Paste SVG markup shared in chats or issues to confirm it renders correctly before merging.',
+ },
+ {
+ title: 'Sanitizing for sharing',
+ description:
+ 'Remove scripts and foreignObject content from untrusted SVGs before sharing them with teammates.',
+ },
+ {
+ title: 'Asset handoff',
+ description:
+ 'Download a cleaned SVG file after minor tweaks or after confirming the exported asset looks right.',
+ },
+ ],
+ },
+ development_tools_Comparison: {
+ title: 'SVG Viewer vs SVG Converter: which one should you use?',
+ description: [
+ {
+ desc: 'Use SVG Viewer when you want to preview SVG markup, inspect basic attributes, and verify how an icon renders.',
+ },
+ {
+ desc: 'Use SVG to React/CSS Utility when you want code output such as React components, CSS Data URIs, or CSS masks.',
+ },
+ ],
+ },
+ development_tool_example: {
+ example_title: 'SVG Viewer example',
+ example_description:
+ 'Here is a simple SVG you can paste into the tool to preview. It includes a viewBox so it scales correctly.',
+ example_input: {
+ title: 'Example SVG markup',
+ json_data:
+ '',
+ },
+ example_outputs: {
+ intro: 'After pasting, you can copy the detected attributes and the sanitized SVG output.',
+ outputs: [
+ {
+ mode: 'Detected attributes',
+ title: 'What you should see',
+ content:
+ '{\\n "width": "120",\\n "height": "120",\\n "viewBox": "0 0 120 120"\\n}',
+ },
+ {
+ mode: 'Sanitized SVG (copy)',
+ title: 'What the tool provides',
+ content:
+ 'A cleaned SVG string suitable for previewing and sharing (scripts/foreignObject removed, inline on* handlers stripped).',
+ },
+ ],
+ },
+ },
+ meta_data: {
+ meta_title: 'SVG Viewer Online – Preview & Inspect SVG Markup',
+ meta_description:
+ 'Preview SVG markup instantly. Upload or paste SVG, inspect width/height/viewBox, copy sanitized SVG, and download .svg files.',
+ og_title: 'SVG Viewer – Free Online Tool',
+ og_description:
+ 'Paste or upload SVG markup to preview it safely, inspect attributes, and copy/download the sanitized SVG output.',
+ og_image: '/images/og-images/Cover.png',
+ },
+ },
+ [`har-file-viewer`]: {
+ hero_section: {
+ title: 'HAR File Viewer',
+ description:
+ 'Upload a HAR (HTTP Archive) file and inspect network requests, responses, headers, payloads, and timings in a clean viewer with search, type filters, and an inline waterfall timeline.',
+ },
+ development_tools_list: [
+ { tool: 'URL Parser & Query String Editor', url: PATHS.URL_PARSER },
+ { tool: 'JSON Prettifier', url: PATHS.JSON_PRETTIFIER },
+ { tool: 'HTML Viewer', url: PATHS.HTML_VIEWER },
+ { tool: 'Curl to Code Converter', url: PATHS.CURL_TO_CODE_CONVERTER },
+ ],
+ development_tools_about_details: {
+ about_title: 'What is a HAR File Viewer?',
+ about_description: [
+ {
+ description:
+ 'A HAR (HTTP Archive) file is a JSON log exported from browser DevTools that contains every network request made during a browsing session.',
+ },
+ {
+ description:
+ 'This HAR File Viewer helps you debug slow page loads, failed requests, redirects, and API errors by letting you search and inspect entries (URLs, status codes, headers, request payloads, response bodies, and timing breakdowns).',
+ },
+ ],
+ },
+ development_tools_user_agent_info: {
+ info_title: 'Privacy & security notes for HAR files',
+ intro_text:
+ 'HAR files can contain sensitive data (cookies, authorization headers, query params, and request/response bodies). Treat a HAR like a password: share only with trusted people and redact secrets before uploading to any third‑party service.',
+ example_string:
+ 'Authorization: Bearer \\nCookie: session=\\nPOST /login { "email": "user@company.com", "password": "••••••" }',
+ example_string_description:
+ 'This viewer runs locally in your browser and does not upload your HAR to a server. Still, consider removing tokens and personal data before sharing the file externally.',
+ info_items: [
+ {
+ part: 'May include secrets:',
+ description:
+ 'Cookies, API keys, bearer tokens, and personal data can appear in headers, URLs, and bodies.',
+ },
+ {
+ part: 'Redact before sharing:',
+ description:
+ 'Replace tokens and credentials with placeholders before attaching HAR files to tickets.',
+ },
+ {
+ part: 'Local processing:',
+ description:
+ 'Your file is parsed and displayed in the browser; the tool does not send it to an external API.',
+ },
+ ],
+ },
+ development_tools_what: {
+ about_title: 'What can you do with this HAR viewer?',
+ what_description: [
+ {
+ descriptions:
+ 'Upload a .har or .json file and instantly browse the captured requests in a searchable list.',
+ },
+ {
+ descriptions:
+ 'Use quick type filters like "XHR", "JS", "CSS", "Img", "Media", and "Errors" to narrow down what you’re investigating.',
+ },
+ {
+ descriptions:
+ 'Click any row to expand details directly below it, including headers, response content, and a timing breakdown.',
+ },
+ {
+ descriptions:
+ 'Use the waterfall timeline to visually compare which requests are slow and which stage (DNS/connect/wait/download) is taking the time.',
+ },
+ ],
+ },
+ development_tools_steps_guide: {
+ guide_title: 'How to use the HAR File Viewer',
+ guide_description: 'Simple steps:',
+ steps: [
+ {
+ step_key: 'Step 1:',
+ step_title: 'Export a HAR file:',
+ step_description:
+ 'Open browser DevTools → Network tab → reproduce the issue → export/save HAR (keep “Preserve log” enabled if needed).',
+ },
+ {
+ step_key: 'Step 2:',
+ step_title: 'Upload or drop the file:',
+ step_description:
+ 'Drag and drop your .har/.json file into the viewer (or use Upload).',
+ },
+ {
+ step_key: 'Step 3:',
+ step_title: 'Search & filter:',
+ step_description:
+ 'Use the search box and type chips (XHR/JS/CSS/Img/Media/Errors) to narrow down to a specific request.',
+ },
+ {
+ step_key: 'Step 4:',
+ step_title: 'Inspect details:',
+ step_description:
+ 'Click a request row to expand its details below and review response headers/content and timing breakdown.',
+ },
+ ],
+ },
+ development_tools_how_use: {
+ how_use_title: 'Common use cases for HAR files',
+ how_use_description: 'Teams use HAR files for:',
+ point: [
+ {
+ title: 'Debugging failed API requests',
+ description:
+ 'Find 4xx/5xx responses quickly and inspect headers and response bodies for error messages.',
+ },
+ {
+ title: 'Performance analysis',
+ description:
+ 'Compare request durations, spot slow endpoints, and review timing breakdowns to identify bottlenecks.',
+ },
+ {
+ title: 'Redirect and caching issues',
+ description:
+ 'Track 3xx chains and review cache-related headers to diagnose unexpected behavior.',
+ },
+ {
+ title: 'Sharing reproducible evidence',
+ description:
+ 'Attach a HAR to tickets so engineers can inspect the exact network activity behind a bug.',
+ },
+ ],
+ },
+ development_tools_Comparison: {
+ title: 'HAR File Viewer vs DevTools Network tab',
+ description: [
+ {
+ desc: 'Use DevTools Network when you can reproduce the issue live and want real-time throttling, replay, and debugging.',
+ },
+ {
+ desc: 'Use a HAR viewer when you’re analyzing a captured session from a teammate/customer and need to search, filter, and share findings quickly.',
+ },
+ ],
+ },
+ development_tool_example: {
+ example_title: 'Example: what to look for in a HAR',
+ example_description:
+ 'After uploading, use the Errors filter to find failing requests and expand one row to inspect details.',
+ example_outputs: {
+ intro: 'Typical workflow:',
+ outputs: [
+ {
+ mode: 'Filter',
+ title: 'Show errors only',
+ content: 'Click the "Errors" chip and search for your API host or endpoint path.',
+ },
+ {
+ mode: 'Inspect',
+ title: 'Open the failing request',
+ content:
+ 'Expand the row and check response headers/content, then review request headers to confirm auth/cookies were sent.',
+ },
+ {
+ mode: 'Timings',
+ title: 'Review performance',
+ content:
+ 'Use the waterfall bar and timing breakdown to identify whether the time is spent on DNS/connect/wait/download.',
+ },
+ ],
+ },
+ },
+ meta_data: {
+ meta_title: 'HAR File Viewer Online – Analyze HTTP Archive Files',
+ meta_description:
+ 'Upload and analyze HAR files online. Inspect requests, responses, headers, payloads, status codes, redirects, and timings to debug network issues faster.',
+ og_title: 'HAR File Viewer – Free Online Tool',
+ og_description:
+ 'View and analyze HAR (HTTP Archive) files. Search entries, inspect headers/payloads/responses, and review timings for performance debugging.',
+ og_image: '/images/og-images/Cover.png',
+ },
+ },
[`what-is-my-local-ip-address`]: {
hero_section: {
title: 'What Is My Local IP Address',