ADB2C custom pages javascript issue

Kruthiventi, BalaSuryaSarathSairam 45 Reputation points
2024-07-23T09:57:27.1766667+00:00

I m using ADB2C user flows for signing up users with azure local accounts and using custom pages - selfasserted html page version 1.2.0 hosted in my blob. I'm trying to register window.onload event in script tag inside head and unfortunately the event listener is not getting triggered.

I have created new js file and referred it <head> section and that seperate js file has just :

window.onload = function() {

console.log("Window has fully loaded and 2 seconds have passed");

}

can this listener be really added? i need to start & show timer when page loads so wanted to use this event & write my own custom js in it.

Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
2,913 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
22,089 questions
{count} votes

Accepted answer
  1. Marilee Turscak-MSFT 36,866 Reputation points Microsoft Employee
    2024-07-24T01:27:00.8266667+00:00

    Hi @Kruthiventi, BalaSuryaSarathSairam ,

    Azure B2C uses its own custom jQuery library, so not all of the document.ready methods work. One workaround is to use the MutationObserver method and searching for the #api element on the page, as discussed in the thread here.

    Another option is to use document.Ready():

     $( document ).ready(function() {
    console.log( "ready!" );
    // now call the JS code in here
    });
    
    

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.