I have a small js function on my site that allows a popup window to be opened by a js link.

Example link:

<a href="javascript:popUp('http://google.ca')" title="Google">Google</a>

I want to input a javascript link, and of course drupal will not allow this in a CCK link field as it tries to validate a URL. To fix this i created basic text field and set it to the nivo link field in the view display settings.

When i view the source of the page with the slider on it, i see that the javascript: is stripped from the link.

How can i get around this? Been looking through the module files but cant seem to find it.

Comments

mikeloyst’s picture

Status: Active » Closed (fixed)

Found a solution - line 122-125 of views_nivo_slider.module

Original Code

    case $options['link_field']:
      if ($field->definition['handler'] != 'views_handler_field_node_link') {
        $link = check_url($field_output);
      }

My modifications

    case $options['link_field']:
      if ($field->definition['handler'] != 'views_handler_field_node_link') {
        //$link = check_url($field_output);
        $link = $field_output;
      }

Disclaimer: I am doing this on a site where only one user has permission to edit content. DO NOT do this on any community site where there are multiple users that can post content for a nivo slider. removing the function check_url() leaves the site vulnerable to an XSS attack if users can enter their own JS code. For more info see http://api.drupal.org/api/drupal/includes--common.inc/function/check_url/6