Skip to content

Commit 8c7f95d

Browse files
fix: Enhance ad network error suppression to include Adform
1 parent ddf54a5 commit 8c7f95d

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/components/Gam.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ export function GamOnPageChange() {
4242
try {
4343
window.fusetag.pageInit()
4444
} catch (error) {
45-
// Suppress cross-origin errors from Publift Fuse ad viewability measurement
45+
// Suppress cross-origin errors from ad network scripts (Publift Fuse, Adform, etc.)
4646
// These can occur on iOS Safari due to strict Same-Origin Policy enforcement
4747
console.debug('Error during fusetag.pageInit():', error)
4848
}
4949
})
5050
} catch (error) {
51-
// Suppress cross-origin errors from Publift Fuse ad viewability measurement
51+
// Suppress cross-origin errors from ad network scripts
5252
console.debug('Error calling fusetag.que.push():', error)
5353
}
5454
}
@@ -58,20 +58,21 @@ export const GamScripts = () => (
5858
<script
5959
dangerouslySetInnerHTML={{
6060
__html: `
61-
// Add global error handler to suppress Publift Fuse cross-origin errors
61+
// Add global error handler to suppress ad network cross-origin errors
6262
// These errors occur in iOS Safari due to strict Same-Origin Policy enforcement
63-
// when the ad viewability script tries to access parent window properties
63+
// when ad scripts (Publift Fuse, Adform, NoBid) try to access parent window properties
6464
// Also suppress race condition errors during navigation
6565
(function() {
6666
var originalErrorHandler = window.onerror;
6767
window.onerror = function(message, source, lineno, colno, error) {
68-
// Check if this is a Publift Fuse cross-origin error
68+
// Check if this is an ad network cross-origin error
6969
if (
7070
source && (
7171
source.includes('/media/native/') ||
7272
source.includes('fuse.js') ||
7373
source.includes('fuseplatform.net') ||
74-
source.includes('/nobid/blocking_script.js')
74+
source.includes('/nobid/blocking_script.js') ||
75+
source.includes('adform.net')
7576
) && (
7677
(message && typeof message === 'string' && (
7778
message.includes('contextWindow.parent') ||
@@ -86,7 +87,7 @@ export const GamScripts = () => (
8687
)
8788
) {
8889
// Suppress the error - log to console in debug mode
89-
console.debug('Suppressed Publift Fuse cross-origin error:', message, source);
90+
console.debug('Suppressed ad network cross-origin error:', message, source);
9091
return true; // Prevent default error handling
9192
}
9293
// Call original error handler for other errors
@@ -103,7 +104,7 @@ export const GamScripts = () => (
103104
async
104105
src="https://cdn.fuseplatform.net/publift/tags/2/4019/fuse.js"
105106
onError={(e) => {
106-
// Suppress script loading errors from Publift Fuse
107+
// Suppress script loading errors from ad network scripts
107108
console.debug('Error loading fuse.js:', e)
108109
}}
109110
/>

0 commit comments

Comments
 (0)