Why doesn't the CientScript.RegisterStartupScript method call the javascript function in Firefox?

160 views Asked by At

I have a code in which I am calling the javascript function from the cs(codebehind) file using the ScriptManager.RegisterStartupScript method.

Though, this works in Google Chrome and Internet Explorer, it doesn't work in Firefox (even the latest one FF 61). But, when i replace the function name with the whole function as it is, it works in Firefox.

I have tried using all the possible alternatives Page.ClientScript, ClientScriptBlock, RegisterStartupScriptBlock etc., only in vain.

Kindly help me.

P.S: I hope I made my question clear.

1

There are 1 answers

0
X.Otano On

Check that your javascript function call is being launched when your page has been rendered completly.

The script you are registering in

ScriptManager.RegisterStartupScript

Should be decorated inside a snippet like this:

string script= @"window.onload = function(){
  // your call to the function...
};"