Skip to content
Open
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
44 changes: 44 additions & 0 deletions src/components/Gam.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,50 @@ export function GamOnPageChange() {

export const GamScripts = () => (
<>
<script
dangerouslySetInnerHTML={{
__html: `
// Add global error handler to suppress Publift Fuse cross-origin errors
// These errors occur in iOS Safari due to strict Same-Origin Policy enforcement
// when the ad viewability script tries to access parent window properties
// Also suppress race condition errors during navigation
(function() {
var originalErrorHandler = window.onerror;
window.onerror = function(message, source, lineno, colno, error) {
// Check if this is a Publift Fuse cross-origin error
if (
source && (
source.includes('/media/native/') ||
source.includes('fuse.js') ||
source.includes('fuseplatform.net') ||
source.includes('/nobid/blocking_script.js')
) && (
(message && typeof message === 'string' && (
message.includes('contextWindow.parent') ||
message.includes('null is not an object') ||
message.includes('is not a function')
)) ||
(error && error.message && (
error.message.includes('contextWindow.parent') ||
error.message.includes('null is not an object') ||
error.message.includes('is not a function')
))
)
) {
// Suppress the error - log to console in debug mode
console.debug('Suppressed Publift Fuse cross-origin error:', message, source);
return true; // Prevent default error handling
}
// Call original error handler for other errors
if (originalErrorHandler) {
return originalErrorHandler.apply(this, arguments);
}
return false;
};
})();
`,
}}
/>
<script
async
src="https://cdn.fuseplatform.net/publift/tags/2/4019/fuse.js"
Expand Down
Loading