The CreatorCon Call for Content is officially open! Get started here.

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

Community Alums
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
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  ||  ✨ 9x 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