Link to home
Start Free TrialLog in
Avatar of markus_pluess
markus_pluessFlag for Switzerland

asked on

Javascript is loaded only in IE9 Compatibility Mode

Hallo,
I have a really strange issue.
My Application loads some user-controls (.ascx) dynamicly.
For some of them i need a javascript function that is stored in
Scripting/LiteUCScripts/LiteUCSripts.js

so i tried to register this script in Init and Load events of my UserControl.
with:
        Dim sPath As String = Page.ResolveClientUrl("~/Scripting/LiteUCScripts/LiteUCSripts.js")
        Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "LucJS", sPath)

Open in new window


like also on the Usercontrol-Page with:
<script src="<%= ResolveClientUrl("~/Scripting/LiteUCScripts/LiteUCScripts.js") %>"  type="text/javascript"></script>

Open in new window


The Issue:
Javascript-File would be only registered if the Browser is in IE9 Compatibility Mode!
Turning the IE in default Mode IE9 the Javascript results in not registered Javascript file.


I will not register it on Masterpage or elsewhere, because i will that my usercontrol can be simply used in other projects, and so that developpers dont have to invest immensely effort to implement this control in their projects.

Does somebody has a idea why this is not working in IE9 default Mode.
ASKER CERTIFIED SOLUTION
Avatar of Tom Beck
Tom Beck
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of markus_pluess

ASKER

Thanks a lot, i tried your solution with "ScriptManager.RegisterStartupScript" and that worked for me!
Thousand thanks!
Great. Thanks for the points.