How to include a page onclick on the client side

Posted 2007-11-03 in JavaScript by Johann.

Here’s a simple example on how to include another page on the clientside using the inc clientside include plugin:

<div id="bla"></div>
<p onclick="$('#bla').inc('blob.txt')">Include stuff</p>

I’m using the onclick event handler here but you could use javascript:-URIs like <a href="javascript:"> as well.

Clientside includes have some limitations.

  • You can only include resources from the current domain (or sub-domain).
  • Mozilla-based browsers seem to only load content with MIME types text/* though I have to look this up.

Demo


Click here to include my robots.txt.

Subscribe

RSS 2.0, Atom or subscribe by Email.

Top Posts

  1. DynaCloud - a dynamic JavaScript tag/keyword cloud with jQuery
  2. 6 fast jQuery Tips: More basic Snippets
  3. xslt.js version 3.2 released
  4. xslt.js version 3.0 released XML XSLT now with jQuery plugin
  5. Forum Scanners - prevent forum abuse
  6. Automate JavaScript compression with YUI Compressor and /packer/

Navigation