All of the documentation assumes the content content load into colorbox will happen as a result of click... (e.g., the parameters calling colorbox are built into the link)

My Example

I want to issue a redirect to a URL that then opens in colobox...

Any suggestions or experience solving this?


You should use java-script and the iframe support in color-box.

<script type="text/javascript">
  $(document).ready(function() {
    $("a", ".the-class-added-to-links-clicking-which-will-open-theurl-in-coloyxbox").click(
      function(event) {
        var elementURL = $(this).attr("href");
        $.colorbox({iframe: true, href: elementURL, innerWidth: 645, innerHeight: 509});

Code Source : https://stackoverflow.com/a/8933655/493742


If you have installed colorbox module that you don't need to add any library files just use the below code to open lightbox in you custom code

<a href="http://hdwallsource.com/img/2014/7/desktop-images-15066-15533-hd-wallpapers.jpg" class="customclass"> Open colorbox </a>

    jQuery(document).ready(function() {
          function(ev) {
            ev.preventDefault(); //To prevent redirection
            var hr = jQuery(this).attr("href");
            jQuery.colorbox({iframe: true, href: hr , innerWidth: 500, innerHeight: 400});

Here href will be link of the page that you want to open in colorbox.

Hope it will help you.


When you load the new URL, you'll need to have javascript on the page to fire the colorbox load event.

  • On the page that is being loaded??? It is a URL that calls a function that then loads a page...
    – sea26.2
    Sep 4 '13 at 23:55
  • First you need to do the redirect, then you need to open the colorbox. It will require javascript. Sep 4 '13 at 23:58
  • Thank you... It looks like the answer is probably no, you can't, unless you can control the content that you are redirecting to. If the content were a foreign URL, then no. I'm I understanding your answer correctly?
    – sea26.2
    Sep 5 '13 at 0:11
  • I was assuming that you controlled the page you were redirecting to...if you don't then the answer is definitely no. Sep 5 '13 at 0:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.