The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   Applications (http://hintsforums.macworld.com/forumdisplay.php?f=5)
-   -   Auto Refresh Safari pages? (http://hintsforums.macworld.com/showthread.php?t=41358)

Reflect_TRUTH 06-24-2005 04:31 PM

Auto Refresh Safari pages?
 
Is there a way to have a Safari webpage refresh automatically every minute to every couple minutes? I have a page that updates very frequently that I need info from.

Im not really familiar with RSS but does it do something like that? I seriously doubt this site does not have a feed (if thats what it needs).

giskard22 06-24-2005 06:36 PM

If RSS is an option, that would be excellent. Safari won't check an RSS feed more often than every 30 minutes, but other RSS readers will let you set pretty much whatever you want.

If RSS isn't an option, you could maybe do this using JavaScript. Keeping in mind I'm not a web coder at all, you could make an html file on your local hard drive with two frames: the first frame just has a JavaScript timer loop that tells the 2nd frame to load a URL every so often.

Reflect_TRUTH 06-24-2005 10:29 PM

I really have NO clue when it comes to Javascript. I've never had to mess with it before. I dont suppose there is another way to do it???

mark hunte 06-25-2005 03:16 AM

Theres a hint here on changing Safari Rss update times

http://www.macosxhints.com/article.p...ery=safari+rss


or you could try a Applescript like below saved as a Application Bundle (stay open) ticked.
The time is set for two minutes (120) and you need to change the url.

Code:

on idle
       
        tell application "Safari"
                activate
                set URL of front document to "http://forums.macosxhints.com/search.php?do=getnew"
        end tell
       
       
        return 120
       
       
end idle


biovizier 06-25-2005 12:15 PM

Quote:

Originally Posted by Reflect_TRUTH
I really have NO clue when it comes to Javascript. I've never had to mess with it before. I dont suppose there is another way to do it???

You don't need javascript - html should do. Try something along these lines:
Code:

<html>
<head>
      <meta ***********="refresh" content="60">
</head>
<body>
<FRAMESET>
      <FRAME src="http://www.macosxhints.com">
</FRAMESET>
</body>
</html>

Change the "60" to the desired interval in seconds, and substitute your url of interest, then save it as plain text with a ".html" extension. Once the file opened in your browser, it should reload itself after the specified interval, and since the frame displays the outside site, it should end up being reloaded as a result, although that might be affected by cache settings.

giskard22 06-25-2005 02:12 PM

Now THAT's what I was talking about. I knew someone would pony up the code. :D

Reflect_TRUTH 08-18-2005 07:08 AM

I have been away for a while and never got to say thank you for this one. Well done.

Forgive my ignorance once again, but what app should I be using to input this HTML string?

I'm afraid Im simple minded and have to be instructed like a 3 year old :o

ThreeDee 09-05-2005 05:18 PM

You can just use TextEdit, and cnange "http;//www.macosxhints.com" to something else. Or you can use Nvu. http://www.nvu.com Its a WYSIWYG editor based on Mozilla's editor.

iambrother 09-24-2007 12:05 PM

Quote:

Originally Posted by biovizier (Post 217368)
You don't need javascript - html should do. Try something along these lines:
Code:

<html>
<head>
      <meta ***********="refresh" content="60">
</head>
<body>
<FRAMESET>
      <FRAME src="http://www.macosxhints.com">
</FRAMESET>
</body>
</html>

Change the "60" to the desired interval in seconds, and substitute your url of interest, then save it as plain text with a ".html" extension. Once the file opened in your browser, it should reload itself after the specified interval, and since the frame displays the outside site, it should end up being reloaded as a result, although that might be affected by cache settings.

Hey, I tried this and it worked, well sort of. I had 2 issues with it, that I was looking for some guidance on. First, each time the page refreshed it returned to the top of the page, when on this website the new data is located on the bottom of page and would require me to scroll. Is there a way for it to refresh to the bottom of the page until the top of the page? Also, is there a way for the script to refresh UNTIL new data appears and then stop refreshing? Finally, when I had it set on "1" for seconds, the page continued to refresh the OLD data even after someone else told me that the page had already been refreshed with NEW data, any explanations?

Thanks,

jman995x 07-23-2008 08:19 PM

Hello,

I too was looking for just this solution.
However, I must be studying too hard because I cut-n-pasted the text in this post into TextEdit, saved it as HTML, then went to my Documents folder and clicked on the file, only to have it open a new Safari window with the HTML coding in it....not the page I wanted....just the HTML coding you see in the aforementioned posts.

What am I missing?

Thanks,

Justin

bensaffer 03-13-2009 07:16 PM

Quote:

Originally Posted by iambrother (Post 410850)
Hey, I tried this and it worked, well sort of. I had 2 issues with it, that I was looking for some guidance on. First, each time the page refreshed it returned to the top of the page, when on this website the new data is located on the bottom of page and would require me to scroll. Is there a way for it to refresh to the bottom of the page until the top of the page? Also, is there a way for the script to refresh UNTIL new data appears and then stop refreshing? Finally, when I had it set on "1" for seconds, the page continued to refresh the OLD data even after someone else told me that the page had already been refreshed with NEW data, any explanations?

Thanks,

Have a look at the source for the website you want to refresh - you should be able to use the "divs".

E.g. If the section you want to refresh to is called "Portfolio" on web site www.example.com

Link to www.example.com/#Portfolio

That should work.

Reloading old data is cos of your cache, have a play with settings (Presume you're in Safari where Cache-ing probs are common) and reload less often than every second as that will cause you problems too. 10 secs min I'd recommend.

bart 01-12-2010 07:13 PM

The frame thing works ok, if you have little more code expertice you can do AJAX / jQuery refresh.

But the idea of this post is to show how to get a non cached page everytime.

You can try using Javascript to add random value.
example: http://www.google.com/?rnd=(random number) will not be cached as far as the random number is different.

another way is to use pragma cache=no-cache on your html.

and, another way to create something more appealing is to use FLASH or JAVASCRIPT to load the webpage webpage.load("http://www.something.com" + Math.rnd() * 9999)
and the parse the data on a function like :

webpage.onData = function(data) {
// parse the data to get the elements you need.
// but this involve more development.
}

Google is your friend.!
Greetings,
Bart.

aokoch 07-29-2010 01:10 PM

HTML reload not working
 
In Safari 5.0, the file loads the "target" page but does not refresh (as if the framset is ignored).

In Firefox 3.6.8, odd characters display (I assume related to the meta tag).

Any ideas, anyone?

Thanks.

aokoch 08-02-2010 11:52 AM

Auto Refresh Solution
 
Use Opera. It has the feature built in.

tommaso 08-03-2010 04:22 PM

Or, in Firefox, use the add-on Reloadevery.

aokoch 08-03-2010 04:51 PM

Reloadevery seems broken in OSX Firefox 3.6.8
 
Installed it on two different Macs without success.

NaOH 08-03-2010 05:08 PM

You can save the following JavaScript as a bookmark – I prefer to store in the Bookmark Bar, but it's your choice – then select this bookmark while viewing the page to be refreshed. It will confirm the page and allow you to set the refresh delay in seconds.

Code:

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')
Someone somewhere deserves credit for that code, but I no longer know who.

MacHead67 08-19-2010 12:07 PM

Absolutely brilliant. Works perfectly; many thanks!!!

Quote:

Originally Posted by NaOH (Post 591794)
You can save the following JavaScript as a bookmark – I prefer to store in the Bookmark Bar, but it's your choice – then select this bookmark while viewing the page to be refreshed. It will confirm the page and allow you to set the refresh delay in seconds.

Code:

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')
Someone somewhere deserves credit for that code, but I no longer know who.


NaOH 08-19-2010 01:06 PM

No credit to me. I'm just sharing what I've found. If you do a web search for JavaScript Bookmarklets you may find other bits of JavaScript code you find useful.

rwelti 06-28-2011 01:52 PM

Just the ticket
 
THANK YOU

I wanted this very thing, too.

Useful if you are online say banking or some other thing, and you don't want to be kicked off. Obviously use with caution.

NaOH 06-28-2011 02:46 PM

There's also at least one Safari extension that provides this type of functionality. I'd be surprised if there aren't others.

jordanwells 06-28-2011 05:31 PM

THANKS SO MUCH! i've been trying to figure this out with safafi for forevvvverrrr


All times are GMT -5. The time now is 03:59 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.