Skip to content

Commit

Permalink
Use CORS proxy to fetch Open Graph tags for websites that do not have…
Browse files Browse the repository at this point in the history
… CORS access

This change will allow us to display link previews for websites that we were not able to display them for before
  • Loading branch information
MMDJafari committed Oct 27, 2023
1 parent 4e1930c commit ab0f851
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/link-preview/open-graph.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default function OpenGraphPreview({ url }) {

useEffect(() => {
async function fetchData() {
const response = await fetch(url);
const response = await fetch(`https://corsproxy.io/?${encodeURIComponent(url)}`);
const html = await response.text();
const doc = new DOMParser().parseFromString(html, 'text/html');

Expand Down

0 comments on commit ab0f851

Please sign in to comment.