Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mrsir2009

macrumors 604
Original poster
Sep 17, 2009
7,505
156
Melbourne, Australia
Would anyone happen to know what the applescript script would be to reload a page on Safari at intervals - Say, reload it every 10 minutes, for example?

Thanks! :)
 

justperry

macrumors G5
Aug 10, 2007
12,558
9,750
I'm a rolling stone.
Would anyone happen to know what the applescript script would be to reload a page on Safari at intervals - Say, reload it every 10 minutes, for example?

Thanks! :)

Does the next thing work for you?

Save this as a bookmark, name it reload or so, the if you want to reload a page click this bookmark(in Bookmark Bar) and it will ask you the time to reload.

javascript:(function(p){open('','',p).document.write('%3Cbody%20id=1%3E%3Cnobr%20id=2%3E%3C/nobr%3E%3Chr%3E%3Cnobr%20id=3%3E%3C/nobr%3E%3Chr%3E%3Ca%20href=%22#%22onclick=%22return!(c=t)%22%3EForce%3C/a%3E%3Cscript%3Efunction%20i(n){return%20d.getElementById(n)}function%20z(){c+=0.2;if(c%3E=t){c=0;e.location=u;r++}x()}function%20x(){s=t-Math.floor(c);m=Math.floor(s/60);s-=m*60;i(1).style.backgroundColor=(r==0||c/t%3E2/3?%22fcc%22:c/t%3C1/3?%22cfc%22:%22ffc%22);i(2).innerHTML=%22Reloads:%20%22+r;i(3).innerHTML=%22Time:%20%22+m+%22:%22+(s%3C10?%220%22+s:s)}c=r=0;d=document;e=opener.top;u=prompt(%22URL%22,e.location.href);t=u?prompt(%22Seconds%22,60):0;setInterval(%22z()%22,200);if(!t){window.close()}%3C/script%3E%3C/body%3E')})('status=0,scrollbars=0,width=100,height=115,left=1,top=1')
 
Last edited:

mrsir2009

macrumors 604
Original poster
Sep 17, 2009
7,505
156
Melbourne, Australia
Does the next thing work for you?

Save this as a bookmark, name it reload or so, the if you want to reload a page click this bookmark(in Bookmark Bar) and it will ask you the time to reload.

javascript:(function(p){open('','',p).document.write('%3Cbody%20id=1%3E%3Cnobr%20id=2%3E%3C/nobr%3E%3Chr%3E%3Cnobr%20id=3%3E%3C/nobr%3E%3Chr%3E%3Ca%20href=%22#%22onclick=%22return!(c=t)%22%3EForce%3C/a%3E%3Cscript%3Efunction%20i(n){return%20d.getElementById(n)}function%20z(){c+=0.2;if(c%3E=t){c=0;e.location=u;r++}x()}function%20x(){s=t-Math.floor(c);m=Math.floor(s/60);s-=m*60;i(1).style.backgroundColor=(r==0||c/t%3E2/3?%22fcc%22:c/t%3C1/3?%22cfc%22:%22ffc%22);i(2).innerHTML=%22Reloads:%20%22+r;i(3).innerHTML=%22Time:%20%22+m+%22:%22+(s%3C10?%220%22+s:s)}c=r=0;d=document;e=opener.top;u=prompt(%22URL%22,e.location.href);t=u?prompt(%22Seconds%22,60):0;setInterval(%22z()%22,200);if(!t){window.close()}%3C/script%3E%3C/body%3E')})('status=0,scrollbars=0,width=100,height=115,left=1,top=1')

Edit: You see a smiley in the link, just quote me and you see the normal code, it's MR's BB code doing this not me.

Man, that's fantastic :D Thanks a ton!
 

justperry

macrumors G5
Aug 10, 2007
12,558
9,750
I'm a rolling stone.
Man, that's fantastic :D Thanks a ton!

This code seems to mess with MR's page formatting (this thread).:eek:

The only problem with this is you get another tab and it needs to be open afaik, I just tested to drag the Tab off so it opens in another window but then it does not work anymore, probably lost connection with the other tab, might be sandboxed.

Cheers Perry
 

mrsir2009

macrumors 604
Original poster
Sep 17, 2009
7,505
156
Melbourne, Australia
This code seems to mess with MR's page formatting (this thread).:eek:

The only problem with this is you get another tab and it needs to be open afaik, I just tested to drag the Tab off so it opens in another window but then it does not work anymore, probably lost connection with the other tab, might be sandboxed.

Cheers Perry

Funny... Because it works fine with me without opening any other tabs.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.