feat(clickTtHttpPageRoutes, ClickTtView): enhance script injection for improved HTML handling
- Added checks to inject the navigation script into the <head> or <body> of HTML responses, ensuring proper script placement for enhanced functionality. - Updated ClickTtView to include a reference for the iframe, improving access to the iframe element for future interactions. - Enhanced overall HTML processing during proxy interactions, contributing to a more robust user experience.
This commit is contained in:
@@ -329,6 +329,14 @@ function injectProxyNavigationScript(html, proxyBaseUrl, pageBaseUrl, sid) {
|
||||
].join('');
|
||||
const script = `<script>${scriptContent}<\/script>`;
|
||||
|
||||
if (/<head[^>]*>/i.test(html)) {
|
||||
return html.replace(/<head([^>]*)>/i, `<head$1>${script}`);
|
||||
}
|
||||
|
||||
if (/<body[^>]*>/i.test(html)) {
|
||||
return html.replace(/<body([^>]*)>/i, `<body$1>${script}`);
|
||||
}
|
||||
|
||||
if (/<\/body>/i.test(html)) {
|
||||
return html.replace(/<\/body>/i, `${script}</body>`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user