If you want to open external links from within the iFrame, you can use the openExternalLinks function. This will close your app and move to a new website.

This, in combination with getRedirectUrl can be used to initiate OAuth flows.

Usage

This function requires the iFrame SDK to be initialized. See iFrame Overview for more information.

"use client";
import { useCallback } from "react";
import { WhopApp } from "@/lib/iframe";

export default function Home() {
  const openLink = useCallback(async () => {
    await WhopApp.openExternalUrl({ url: "https://google.com" });
  }, []);

  return <button onClick={openLink}>Click me to open Google</button>;
}