Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fluffy-cycles-throw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'react-frame-component': minor
---

Add fallback to document.write() for initial frame rendering via dangerouslyUseDocWrite prop to support libraries like Repcaptcha and Google Maps that depend on the frame's location/origin.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ The `mountTarget` props is a css selector (#target/.target) that specifies where
</Frame>
```

###### dangerouslyUseDocWrite
`dangerouslyUseDocWrite: PropTypes.bool`

Defaults to `false`

The frame's initial content, as defined by the `initialContent` prop, is populated via the frame's `srcdoc` attribute by default. However, this can cause issues with some libraries such as Recaptcha and Google Maps that depend on the frame's location/origin. In these cases, setting this flag will cause `Frame` to use `document.write()` to populate the initial content. This is **unperformant and unrecommended**, but allows these libraries to be used inside a `Frame` instance.

###### contentDidMount and contentDidUpdate
`contentDidMount: PropTypes.func`
`contentDidUpdate: PropTypes.func`
Expand Down
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ declare module 'react-frame-component' {
initialContent?: string | undefined;
contentDidMount?: (() => void) | undefined;
contentDidUpdate?: (() => void) | undefined;
dangerouslyUseDocWrite?: boolean | undefined;
children: React.ReactNode;
}

Expand Down
Loading
Loading