Error: mainFrame[0].contentDocument is null

Shruthi1
Kilo Explorer

Am integrating servicenow with other site.Say www.example.com.On redirecting from Servicenow to that site there is an error which will be seen i.e Error: mainFrame[0].contentDocument is null

3 REPLIES 3

Priyanka Vasant
Tera Guru

Hi Shruti,

you can try below things : $window.document.querySelector or $window.document.getElementById or $window.document.querySelectorAll to query iframe element, which content you need to access. For example, if your custom Service Portal page has only one iframe, you can use $window.document.querySelector("iframe").contentWindow to access the contentWindow. Alternativelyangular.element("iframe")[0].contentWindow should work too.

Regards,

Priyanka

Thanks Priyanka,

 

But how am i supposed to change that.Because i assume it is in servicenow side,

find_real_file.png

find_real_file.png

Tanushree Doiph
Mega Guru

Hi 

Are you using DOM in your script somewhere like document.getElementById

if yes then have you made the below changes to the system property?

glide.script.block.client.globals=false

if no then please do it and test again.

 

And moreover, if you can elaborate on what you are trying to integrate with, that would be great, as you have posted very little information regarding integration you are trying to achieve.

 

Thanks and regards

Tanushree Doiphode