# Web Resource is not loading correctly

**URL:** <https://community.developer.atlassian.com/t/web-resource-is-not-loading-correctly/65386>\
**Category:** Jira Server\
**Tags:** jira-server, java, jira-plugin\
**Created:** [January 23, 2023, 12:33am UTC](https://community.developer.atlassian.com/t/web-resource-is-not-loading-correctly/65386 "2023-01-23T00:33:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dchouksey89](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/dchouksey89/32/37740_2.png) [@dchouksey89](https://community.developer.atlassian.com/u/dchouksey89)\
**Post date:** [January 23, 2023, 12:33am UTC](https://community.developer.atlassian.com/t/web-resource-is-not-loading-correctly/65386/1 "2023-01-23T00:33:59Z")

</div>

Hi Experts,

I am using a web resource module in my plugin which was working fine with Jira 8. x.x. When I tested with Jira 9 it is not working correctly. It seems my xyz.js file is executing partially or before the page loads.

**Note:** My xyz.js file needs to execute on jira.view.issue page after page loads.

**atlassian-plugin.xml**

```auto
 <web-resource key="xyz-resources-issue-view-${project.version}" name="Xyz View Web Resources">
		    <resource type="download" name="issue_view_xyz.js" location="/js/issue_view_xyz.js"/>  
		    <context>jira.view.issue</context>
</web-resource>

```

---

<div class="post-metadata">

**Author:** ![AlejandroSurezTecnof](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/alejandrosureztecnof/32/48005_2.png) [@AlejandroSurezTecnof](https://community.developer.atlassian.com/u/AlejandroSurezTecnof)\
**Post date:** [January 26, 2023, 2:39pm UTC](https://community.developer.atlassian.com/t/web-resource-is-not-loading-correctly/65386/2 "2023-01-26T14:39:12Z")

</div>

Hi @dchouksey89 i’m having the same problem. The web resources are loading even if the condition attached result is false.

There is a workaround that not involves to check the condition from javascript?

Thanks!

---

<div class="post-metadata">

**Author:** ![m.herrmann](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/m.herrmann/32/37582_2.png) [@m.herrmann](https://community.developer.atlassian.com/u/m.herrmann)\
**Post date:** [January 26, 2023, 3:02pm UTC](https://community.developer.atlassian.com/t/web-resource-is-not-loading-correctly/65386/3 "2023-01-26T15:02:00Z")

</div>

We execute our JS code using AJS.toInit, not sure if there is a better way. In addition you may need to check if AJS?.toInit is even a function and make a timeout otherwise.

```auto
if (typeof window.AJS?.toInit === 'function') {
	return window.AJS.toInit(() => yourInitMethod());
}
...
code to wait for toInit to be present

```
