Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Unanswered

JS not executing on Portal Web Page.

(0) ShareShare
ReportReport
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

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,359 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans