Run custom javascript when page loads

Posted by Husain Dalal on Oracle Blogs See other posts from Oracle Blogs or by Husain Dalal
Published on Fri, 16 Nov 2012 22:19:48 +0000 Indexed on 2012/11/16 23:08 UTC
Read the original article Hit count: 199

Filed under:

Ran into a neat way to load and run custom javascript when an ADF page loads:

        <af:resource type="javascript">

          function onLoad() {   
           alert("I am running ! ");
          }
          //Script block
          if (window.addEventListener) {
            window.addEventListener("load", onLoad, false)
          } else if (window.attachEvent) {
             window.detachEvent("onload", onLoad)
             window.attachEvent("onload", onLoad)
          } else {
            window.onload=onLoad
          }
        </af:resource> 

 

Reference: http://docs.oracle.com/cd/E23943_01/webcenter.1111/e10148/jpsdg_pagelet.htm#BABGHCBF

 

© Oracle Blogs or respective owner

Related posts about /ADF