You need to sign in to do that
Don't have an account?
JWikk
Visualforce page to run javascript onload?
is it possible to have javascript run upon opening a visual page? I know I can get the apex controller constructor to run, but I want javascript to access the browser url.
The following only works in development mode:
<script type="text/javascript"> var detailURL= parent.document.referrer; detailURL = detailURL.substring(detailURL.lastIndexOf('/')+1); function init() { if ((detailURL > "" ) && (detailURL.length == 15)) { alert('pushing '+detailURL); nowPushURL(detailURL); } } parent.onload = init; //window.onload; </script>
Use this instead:
All Answers
Use this instead:
Try out sample code given below :
window.onload = new function() { checkCondition(); };
function checkCondition()
{
// your logic here
}
Hope this helps.