window.open written in a client script and its not working on Service Portal

prabh
Mega Expert

Hi Folks,

I have a catalog item and in that there is onchange client script which opens different URLs based on the value selected using window.open() function.

But this script is not working on Service Portal. I have changed the UI type of the script to "Both" as well.

Please help.

Thanks

Preety Arora

23 REPLIES 23

Abdul Khan4
Kilo Guru

Please try


window.top.location or

window.parent.location


Hi Abdul,



Its not working.



Thanks


Hi Abdul,



My mistake... this is working but I want to open the link in new tab not in same window.


can you please give me screen shot of code you are trying to fix. (Full page screen)


Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Preety,



According to the github documentation, many client side objects including window are not available within Service Portal:


Unsupported client scripting globals

The following globals and APIs are unavailable in service portal client script:


  • window
  • document
  • $
  • jQuery
  • $$
  • $j
  • angular


documentation/client_scripting.md at master · service-portal/documentation · GitHub