We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

document.URL.indexOf not working in client script in servicenow

Not applicable

document.URL.indexOf not working in client script in servicenow
can u tell me why is it not working and tell me any alternative

2 REPLIES 2

Ankur Bawiskar
Tera Patron

@Community Alums 

use this in native

var index = top.location.href.indexOf('your value');

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Robert H
Mega Sage

Hello @Community Alums ,

 

To access the document interface from a Client Script please use this:

top.document.URL

 

Regards,

Robert