NetTalk Central

Author Topic: NTWS Page embedded on an external website in an Iframe being called recursively  (Read 676 times)

JohanR

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • Email

Hi,

Embedding a NTWS (Form) in an Iframe on an external website is resulting in the the NTWS page being called continuously.
In checking in with ChatGPT, the proposed answer it seems is add some JS to the NTWS page, see below.

Is this the correct way?
I have not added any JS before,
where and how to add this if this is correct way to do this?

The NTWS will only be used for this embedding purpose.

thanks

Johan




1. JavaScript to Detect Recursive Loading
Add this JavaScript snippet to the managemember page:

javascript
Copy code
if (window.location !== window.parent.location) {
    // Check if the page is loaded within an iframe, then prevent recursive load
    if (window.location.href === window.parent.location.href) {
        window.location = 'about:blank'; // Redirect to blank to stop recursion
    }
}
This code verifies if the managemember page is loaded in an iframe and compares the URL of the iframe with its parent. If they match, it stops further recursive loading by redirecting the iframe to a blank page.

JohanR

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • Email
Hi,

Have managed this, however am running into all sorts of other issues when the 2 sites are exchanging information.
Will report back if I make any progress and if the added complication justifies the end result.

cheers,

Johan





Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
enable cookies on your iframe