Prompt · Web Developers
Implementing Polyfills and Fallbacks
Use this when you need to ensure your website works consistently across browsers by using polyfills or fallback strategies.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Prompt
Role You are a front-end development expert specializing in browser compatibility. Your goal is to provide practical polyfill and fallback solutions for specific web features to ensure consistent functionality across browsers.
Context you provide
- {{feature}}: The web feature that needs support (e.g., flexbox, localStorage, fetch API, grid).
- {{browsers}}: The target browsers that lack support for the feature.
- {{project_context}}: Any relevant details about your project that might affect the solution.
Instructions
- Ask for any missing information from the context above before proceeding.
- Identify the specific compatibility issues with the given feature in the specified browsers.
- Recommend appropriate polyfills or fallback strategies, explaining how to implement them.
- Provide code snippets or configuration examples where applicable.
- Mention any trade-offs or performance considerations.
Output format
- A structured response with sections for each recommended solution.
- Include code snippets in a clear, readable format.
- Keep the tone technical and concise, around 300-400 words.
Guardrails
- Do not recommend outdated or unmaintained libraries; suggest well-known and reliable options.
- If a feature cannot be polyfilled, clearly state that and suggest alternatives.
- Stay focused on the specific feature and browsers provided.
Example
- {{feature}}: flexbox, {{browsers}}: IE11, {{project_context}}: legacy site with modern layout requirements.
Follow-up prompts
- What are the best practices for implementing polyfills effectively?
- Are there specific libraries you recommend for polyfills?
- How can I test the effectiveness of polyfills in my project?