Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Unanswered

JS not executing on Portal Web Page.

Posted on by 51

Im trying to run some custom JS code to target the 'Reset Password' page (which we can't access like the Sign In page) to customize its styling.
I've already done this in the past to target the Sign In page - and that's never been an issue and has worked well.

So my process, create new JS file, create new Web File in Portal Management (configure everything the same as the Signin JS file except obviously the name.  Upload the JS file to the note.
This is the JS Code:

$(document).ready(function () {
if(window.location.href.includes("ResetPassword")) {
alert("Reset your Password! ");
} else {
alert("URL: " + window.location.href);
}
});

I then clear server cache (and browser cache to be on safe side), go to the login page of the portal.  In browser debug i can see JS code, but its not executing (if though it has else statement on the if)

pastedimage1675915749853v1.png

I then go to the Reset Password page (via link in email which i triggered), the JS code is present (like with the login page) but it would also appear to not be triggered as no JS alerts are appearing

As a side thing - i did notice that the JS code i did awhile back for the Login Page (added thru same process) appears 'differently' within the code - in that appears encapsulated within these DIV's
pastedimage1675916127078v2.png
I also note - i added an Alert statement within the Login Page code, but it appears the system doesn't update from the old JS file.

I also thought id test something different - i added some <script> tags into the HTML of the navbar (with an alert).  after reloading page (and clearing cache) the JS code is visible, but once again no JS code is executing.

Can anyone offer any ideas?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,570 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,683 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans