I’m trying to write some javascript for a Site Configuration file which will authenticate before redirecting back to the original url. I think that it’s nearly there but struggling to actually get it working! Does anyone know of a good way to debug this? I’ve tried using Google Javascript Console to see if it works. However, the jQuery object cant be used directly in the console. I’m guessing I need to use some other syntax to use jQuery directly. Anyone have any suggestions?
Here’s my site config, in case you can spot something that i’m doing wrong:
<br />
<!-- Loading --><br />
<state name="loading"><br />
<event><br />
<condition><br />
<frameLoaded /><br />
</condition><br />
<br />
<action><br />
<run script="function logMeIn(){login.userName.value='${username}';login.password.value='${password}';login.nextUrl.value='/page/playLiveTv.do?epgChannelId=1301';login.onsubmit();}"/><br />
<run script="var result=document.cookie.match(/skySSO=(.+?);/g);if(result==undefined){jQuery.load('https://skyplayer.sky.com/vod/content/Home/Application_Navigation/Sign_in/content/login.do',function(){logMeIn();});}"/><br />
<pause time="5000" /><br />
<goto state="playing" /><br />
</action><br />
</event><br />
</state><br />
<br />
<!-- Playing --><br />
<state name="playing"><br />
<event><br />
<condition><br />
<frameLoaded /><br />
</condition><br />
<br />
<action><br />
<!-- Do Nothing --><br />
</action><br />
</event><br />
</state><br />
Is it correct to use 'jQuery.load'... with a callback function to programmatically submit the login page?
Thanks in advance!