Important

Major updates are in progress. Some pages and languages may not be available.

Using the JS Plugin

The JS (JavaScript) plugin is another very useful plugin for extending your Tiki. With it you can easily include SCRIPT elements in a wiki page. For example, to embed this widget (from Widgetbox) in a wiki page:


Widgetbox generates the following code:

Widgetbox script
<script type="text/javascript" src="http://cdn.widgetserver.com/syndication/subscriber/InsertWidget.js"></script>
<script type="text/javascript">
  if (WIDGETBOX) 
    WIDGETBOX.renderWidget('5916c179-aace-43f5-b07a-3ac0df9d8546');
</script>


If you attempt to simply copy and paste this code into a wiki page, Tiki will sanitize the script elements. Instead, use the JS plugin:

Using JS plugin
{JS(file="http://cdn.widgetserver.com/syndication/subscriber/InsertWidget.js") /}
{JS()}if (WIDGETBOX) 
    WIDGETBOX.renderWidget('5916c179-aace-43f5-b07a-3ac0df9d8546');
{JS}


Notice that we've use two instances of the JS plugin:

  • The first references a hosted JavaScript file
  • The second includes actual JavaScript code that must be added to the page.

{NOTE()}You can use the JS plugin to both add a JavaScript file and include JavaScript code.{NOTE}

{TIP()}If you need to add a script that should appear on every page of your Tiki (for example, the Google Analytics script, use the Customization tab of the Admin: Look & Feel page instead of the JS Plugin.{TIP}


Enabling the JS Plugin

In the same way that you had to enable the HTML plugin, you must enable the JS plugin in order to use it in a wiki page.

If you attempt to use a disabled plugin, Tiki displays the following message:
Plugin disabled

Select to enable the plugin, and click Set.


Approving the JS Plugin

Some plugins, especially those that allow users to embed specific coding such as the JS plugin, require approval before they become "live." Only users with then necessary permissions can approve a plugin.

Using JS plugin
{JS(file="http://cdn.widgetserver.com/syndication/subscriber/InsertWidget.js") /}
{JS()}if (WIDGETBOX) 
    WIDGETBOX.renderWidget('5916c179-aace-43f5-b07a-3ac0df9d8546');
{JS}


Notice that we've use two instances of the JS plugin:

  • The first references a hosted Javascript file
  • The second includes actual Javascript code that must be added to the page.

{NOTE()}You can use the JS plugin to both add a JS file and include JS code.{NOTE}


In this section

    Enabling the JS Plugin

    In the same way that you had to enable the HTML plugin, you must enable the JS plugin in order to use it in a wiki page.

    If you attempt to use a disabled plugin, Tiki displays the following message:
    Plugin disabled

    Select to enable the plugin, and click Set.


    Approving the JS Plugin

    In the same way that you had to approve the HTML plugin, you must approve the JS plugin.

    To approve the pending JS plugin:

    1. Click View Details. Tiki displays the details of the JS plugin.
      Plugin details
      Details of the JS plugin.
    2. Select one of the following options:
      • Click Preview to execute the plugin once. Tiki reloads the page, executing the plugin. But for subsequent page visits, the plugin will not execute.
      • Click Approve make the plugin "live." Tiki reloads the page, fully executing the plugin code.
      • Click Reject to disapprove the plugin and deny its execution. Tiki displays the following message:
        Plugin denied
        You should edit the page and remove the denied plugin code.

    Advertising