To open an URL in a modalframe using Colorbox, it should be like this (according to the documentation):
"[path]?width=500&height=500&iframe=true"
These URL parameters are passed onto the target website. So when you take a look at the Modalframe, you can see the URL used is:
<div id="cboxLoadedContent" style="width: 1400px; overflow: auto; height: 900px; "> <iframe frameborder="0" name="cbox1344331012950" src="http://example.com/?width=1400&height=900&iframe=true" class="cboxIframe"></iframe></div>
This is not correct by design I think, why should you pass the parameters needed for the Colorbox onto the target website. This leads to problems in two cases I think:
- When you want to pass parameters to the target website. Sometimes you want to open a target website and pass a parameter for height. How can this work when the parameters for the Colorbox are still in de URL?
- Sometimes the target website cannot handle the URL because of the parameters (especially with web applications). In our situation we got the message: "The page you are trying to request does not (yet) exist.". Because the web application didn't know how to handle the parameters.
Possible solution:
It would be much better when the parameters for the colorbox are passed as arguments in the class instead of the URL (something like: http://archive.plugins.jquery.com/project/metadata). Don't how if it works, but would be a cleaner solution.
Ugly patch:
For the time being I have quite an ugly patch to get this working.
In the colorbox_load.js I strip the arguments from the URL when creating the iframe. It is a really ugly patch, but this is the only think I could think of because, unfortunately, my knowledge of Javascript and Jquery is quite limited.
iframe:function(){
return $.urlParam('iframe', $(this).attr('href'));
},
-->
iframe:function(){
var html = $.urlParam('iframe', $(this).attr('href'));
$(this).attr('href', $(this).attr('href').split('?width=')[0]);
return html;
},
Comment | File | Size | Author |
---|---|---|---|
#5 | colorbox-colorbox_load.js-1710528-1-pathfix.patch | 563 bytes | sblommers |
#1 | colorbox-colorbox_load.js-1710528-1.patch | 555 bytes | pvanerk |
Comments
Comment #1
pvanerk CreditAttribution: pvanerk commentedPatch
Comment #2
pvanerk CreditAttribution: pvanerk commentedComment #3
frjo CreditAttribution: frjo commentedClosing old issues that doesn't seems to effect a lot of users.
Comment #4
Stevel CreditAttribution: Stevel commentedI'm also affected by this issue. The width, height and iframe parameters are still passed to the iframe in the latest version.
Comment #5
sblommers CreditAttribution: sblommers commentedAdded fixed colorbox_load patch with correct patch (so it works with patch from root and drush make)
Comment #6
frjo CreditAttribution: frjo commented