Skip to content

Commit ab0f851

Browse files
committed
Use CORS proxy to fetch Open Graph tags for websites that do not have CORS access
This change will allow us to display link previews for websites that we were not able to display them for before
1 parent 4e1930c commit ab0f851

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/components/link-preview/open-graph.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default function OpenGraphPreview({ url }) {
55

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

0 commit comments

Comments
 (0)