471,881 Members | 1,305 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,881 software developers and data experts.

making it so a particular image is the first thing loaded

A webpage can include any number of images, cascading stylesheets,
frame's, etc. How might I go about making it so a particular image
loads before any of these others? Ideally, the image would load even
before the rest of the page loaded.

Any ideas as to how this might be done?

(I'm asking because I'm using a 1x1 image to simulate a cron job)

Aug 10 '07 #1
8 1929
yawnmoth wrote:
A webpage can include any number of images, cascading stylesheets,
frame's, etc. How might I go about making it so a particular image
loads before any of these others?
I don't think that can be done.
(I'm asking because I'm using a 1x1 image to simulate a cron job)
There is probably a better way to do what you want to do, but it
probably would involve a non-html solution. What are you ultimately
trying to accomplish?
Aug 10 '07 #2

yawnmoth <te*******@yahoo.comwrote:
A webpage can include any number of images, cascading stylesheets,
frame's, etc. How might I go about making it so a particular image
loads before any of these others?
You can't.

You can't even guarantee that the particular image will be loaded at all.
--
Darin McGrew, mc****@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp.com, http://www.HTMLHelp.com/

"I can take one day at a time, but sometimes several days attack me at once."
Aug 10 '07 #3
On Aug 9, 11:30 pm, Scott Bryce <sbr...@scottbryce.comwrote:
yawnmothwrote:
A webpage can include any number of images, cascading stylesheets,
frame's, etc. How might I go about making it so a particular image
loads before any of these others?

I don't think that can be done.
(I'm asking because I'm using a 1x1 image to simulate a cron job)

There is probably a better way to do what you want to do, but it
probably would involve a non-html solution. What are you ultimately
trying to accomplish?
Basically, what I just said. I'd like to make a modification for an
open source package that'd let admins run whatever PHP script they
wanted to at designated time intervals. If you only got one visitor
every two hours, and you wanted your script to run every hour, that'd
be a problem, but I don't think there's much I can do about that.

I can't rely on cron because the admin might have safe mode enabled,
might not be running on Linux, etc.

At the same time, though, it wouldn't be all that spectacular if the
script was always the last thing to load on the page. If it were,
then people could just click another link and load another page before
the image on the first page had a chance to load.

Aug 10 '07 #4
On Aug 9, 11:47 pm, yawnmoth <terra1...@yahoo.comwrote:
A webpage can include any number of images, cascading stylesheets,
frame's, etc. How might I go about making it so a particular image
loads before any of these others? Ideally, the image would load even
before the rest of the page loaded.

Any ideas as to how this might be done?

(I'm asking because I'm using a 1x1 image to simulate a cron job)
You can use the onload element

http://www.w3schools.com/appml/el_onload.asp

www.richardfisher.com

Aug 10 '07 #5
Scripsit Helpful person:
You can use the onload element
You didn't really understand the question, did yoy?
http://www.w3schools.com/appml/el_onload.asp
Citing w3schools as a reference is always a useful signal of bogosity -
especially in a group where the unreliability of w3schools has often been
mentioned.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Aug 10 '07 #6
Scripsit yawnmoth:
What are you ultimately trying to accomplish?

Basically, what I just said. I'd like to make a modification for an
open source package that'd let admins run whatever PHP script they
wanted to at designated time intervals.
How is this related to HTML authoring? And how would loading an image do
that? Even if the image URL refers to a PHP script, the script will be run
at _irregular_ and _unpredictable_ intervals: when the page is accessed by
someone using a browser that loads images.

If you just want to run a PHP script when a page is accessed, just make the
page a PHP page so that the PHP code first executes whatever you like and
then generates and sends the page.

If you need further help with this, please note that _this_ group discusses
HTML authoring for the HTML, and PHP and other server-side techniques are
not HTML.
At the same time, though, it wouldn't be all that spectacular if the
script was always the last thing to load on the page. If it were,
then people could just click another link and load another page before
the image on the first page had a chance to load.
What are you talking about?

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Aug 10 '07 #7
On Aug 10, 11:58 am, "Jukka K. Korpela" <jkorp...@cs.tut.fiwrote:
Scripsityawnmoth:
What are you ultimately trying to accomplish?
Basically, what I just said. I'd like to make a modification for an
open source package that'd let admins run whatever PHP script they
wanted to at designated time intervals.

How is this related to HTML authoring?
It isn't. That's why I didn't volunteer the information. What I was
asking wasn't how to do this - it was "how to make it so a particular
image loads first". Was there some HTML markup that'd allow me to do
this?
And how would loading an image do
that? Even if the image URL refers to a PHP script, the script will be run
at _irregular_ and _unpredictable_ intervals: when the page is accessed by
someone using a browser that loads images.
No shit. But if your webhost doesn't let you do cron jobs or use the
Windows Scheduler, or whatever, it may be the best option you got.
But what does any of this have to do with html authoring? I suggest
you drop this line of inquiry since it *is*, after all, off topic,
here. The only thing that is on topic here is whether or not you can
make an image load before others and that question has been answered.

Aug 12 '07 #8
Jukka K. Korpela wrote:
After you were told that HTML does not deal with such issues (which
is what you should have known already), there was no point to babble
here any more.
I asked him to.

It was reasonable to ask what your _real_ problem was, since it is
possible that the real problem has an HTML solution, or at least some
HTML relevance.
Actually, it looked to me like his real problem would need a server-side
solution. I was thinking that we could point him to a better resource
than this newsgroup if we knew what he was trying to accomplish.

You're looking for reactions to unpredictable events as a solution to
your (assumed) problem of scheduled runs.
That is true. If those unpredictable events happen often enough, and the
scheduled runs don't have to be right on schedule, this solution may be
good enough.

The OP should google "fake cron." I've seen something written in Perl. I
don't know if there is a PHP fake cron, but perhaps the OP can take
ideas from a Perl fake cron and write his own in PHP.
Aug 12 '07 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Gregory | last post: by
3 posts views Thread by Randell D. | last post: by
4 posts views Thread by Christina Androne | last post: by
9 posts views Thread by Mark Denardo | last post: by
3 posts views Thread by kayahr | last post: by
6 posts views Thread by Jerry West | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.