views:

32

answers:

2

Is it possible to link to ONLY a div on a web page? For example,

<html>
    <body>
        Here is some content I don't care about
        <div class="stuff">
            Here is some content I want. Blah blah. It may change from time to time
        </div>
        Here is more content I don't care about and do not want to see when this link is clicked
    </body>
</html>

Is there a hyperlink that will display only the contents of "stuff" with nothing else?

For further clarification, if someone were to make an of this link, nothing else from that page would appear in the iframe.

A: 

The short answer is: No

The longer answer involves a bunch of JavaScript on the page where the content is to be hidden (i.e. you couldn't do it to a third party site, and if it is your own site you would almost certainly be better off just creating a separate URI you could call)

David Dorward
+3  A: 

You could use a jQuery .load() call to get that fragment of your page and load it on your single page:

$('#result').load('your-page.html .stuff');
Pat
I wish I could +10 this answer.
Lazarus
I'll just read it 10 times to make up for it
thomas