Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

Transclude content via <script> tags

Project description

This simple script lets people include bits of your content (hosted on whatever server you like) into their own pages. It uses the age-old technique used by ads of issuing writes from a Javascript file.

If you mount this at then you can use tags like:




These each include the content from the encoded-url. If you give a fragment, it grabs just the bit of identified text. If you don’t, it’ll take all the text in the <body> of the page.

It will put the output exactly where the <script> tag is in the page. If you want to put it someplace else, &dest=id will put it in the element with the given id. In that case it adds a little onload(-like) handler, and then sets the innerHTML of element with that id. If you can’t fetch the url, then it will put a small error message into the page in its place.

By default it restricts urls based on the opt-in wildcards of the allowed_urls setting. You can use allowed_urls = * to allow anything, but this is not recommended. You can also use same_host = true to allow requests to the same host as where the includer is hosted.

To minimize backend traffic, set cache_dir to a location to save the requested pages. All the caching is handled by httplib2.


To run an example, install the package and use paster serve development.ini (development.ini is in the tarball). This will start up a server on http://localhost:8080/ where you can view an example.



  • In some cases extra <body> tags would be included in the transcluded content (when that tag should never be present).


Initial release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ScriptTranscluder, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size ScriptTranscluder-0.2.tar.gz (8.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page