plane/space/hooks/use-is-in-iframe.tsx
Prateek Shourya f13c190676
[WEB-1396] chore: remove/ disable all actionable items from deploy url in case url is embedded using Iframe. (#4544)
* fix: is in iframe validation check

* chore: remove/ disable all actionable items from deploy url in case url is embeded using Iframe.

* chore: remove copy issue link option if clipboard write access is not granted.

---------

Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
2024-05-22 12:39:34 +05:30

18 lines
334 B
TypeScript

import { useState, useEffect } from "react";
const useIsInIframe = () => {
const [isInIframe, setIsInIframe] = useState(false);
useEffect(() => {
const checkIfInIframe = () => {
setIsInIframe(window.self !== window.top);
};
checkIfInIframe();
}, []);
return isInIframe;
};
export default useIsInIframe;