Forum Moderators: not2easy

Message Too Old, No Replies

Calling CSS from HTML

         

cyberout

6:21 pm on Oct 7, 2005 (gmt 0)

10+ Year Member



Is there any possible way, be it Javascript or some other way, to grab the URL of a CSS from a web page and have the page calling up that URL use it as its CSS style?

fish_eye

3:10 am on Oct 10, 2005 (gmt 0)

10+ Year Member



Hi cyberout and welcome to WebmasterWorld!

Without using specific URLs (see the ToS [webmasterworld.com]) can you please provide an example of what you mean.

For example:
1) [example1.com...] calls [example2.com...] which uses [example2.com...]
2) I want [example1.com...] to be displayed using style sheet [example2.com...]

cyberout

11:59 pm on Oct 10, 2005 (gmt 0)

10+ Year Member



Say index.html on some other sites page has the tag:
<link href="style01.css" rel="stylesheet" type="text/css">

I want to be able to grab the href from that page and add it to my own page but for example as:

<link href="http://www.somesite.org/css/style01.css" rel="stylesheet" type="text/css">

Such applications could be used in frames, especially if done in JavaScript, would make pointing to CSS easier, perhaps?

fish_eye

12:55 am on Oct 11, 2005 (gmt 0)

10+ Year Member



There may be some snazzy way of doing it but I'm not familiar with it.

I'm assuming you know the real name of "http://www.somesite.org" therefore you don't need to discover that?

In that case my language of choice would be php (yours could be anything else you're comfortable with) and I would:
1) physically copy the file "index.html" (if I knew it was called that); and
2) text string search through it looking for the directory of the css (if necessary - in your example it seems like you'd need to); and
3) text string search through it looking for the css file name; and
4) build the html to use it.

Perhaps a "bleeding obvious" response (sorry about that) but it may help.

I'm intrigued as to why you want to do this!?