Edit this page

up.fragment [up-source]
HTML selector

Sets this element's source URL for reloading and polling

When an element is reloaded, Unpoly will make a request from the URL that originally brought the element into the DOM. You may use [up-source] to use another URL instead.


Assume an application layout with an unread message counter. You use [up-poll] to refresh the counter every 30 seconds.

By default this would make a request to the URL that originally brought the counter element into the DOM. To save the server from rendering a lot of unused HTML, you may poll from a different URL like so:

<div class="unread-count" up-poll up-source="/unread-count">
  2 new messages

Modifying attributes

up-source string

The URL from which to reload this element.