#17050 closed defect (bug) (fixed)
Built in Thickbox close image relative path error
Reported by: | maorb | Owned by: | |
---|---|---|---|
Milestone: | 3.2 | Priority: | normal |
Severity: | normal | Version: | 3.1 |
Component: | External Libraries | Keywords: | |
Focuses: | Cc: |
Description
When using the built in Thickbox modal window on the frontned, the link to the close image is a relative path to - ../wp-includes/js/thickbox/tb-close.png
This making the icon not appear if user is on an inside page of the site, since the relative path is no longer correct.
The file contains this is wp-includes/js/thickbox/thickbox.js
Lines 8-13 are these:
if ( typeof tb_pathToImage != 'string' ) { var tb_pathToImage = "../wp-includes/js/thickbox/loadingAnimation.gif"; } if ( typeof tb_closeImage != 'string' ) { var tb_closeImage = "../wp-includes/js/thickbox/tb-close.png"; }
When replaced with relative path to root and not to parent directory, it is working well and fixes this error --
if ( typeof tb_pathToImage != 'string' ) { var tb_pathToImage = "/wp-includes/js/thickbox/loadingAnimation.gif"; } if ( typeof tb_closeImage != 'string' ) { var tb_closeImage = "/wp-includes/js/thickbox/tb-close.png"; }
Change History (9)
#1
@
14 years ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
#2
@
14 years ago
- Milestone set to Future Release
- Resolution duplicate deleted
- Status changed from closed to reopened
However, Now that I've closed it, I'm wondering why this isn't being handled by passing the url through site_url() + inserting it through our translation functions. This would allow it to work seamlessly on both the front and back ends..
#3
@
14 years ago
@dd32 Thanks and I agree with you.
Meanwhile, I will use your solution of adding the js vars to the head, it will be better than changing the core.
#9
@
14 years ago
Perhaps we should (finally) separate the default scripts and default stylesheets from script loader and remove all these dummy functions. Should have done that when introducing load-scripts.php
and load-styles.php
.
That would probably make life a bit easier for caching plugins too.
Of course we will still need 1-2 dummy functions in these files when using a function directly in the JS args like in this case but that seems quite easier to manage and could be triggered by checking whether ABSPATH
is defined, etc.
You cant use absolute paths (relative to root) because not all WordPress installs are rooted at /
The thickbox script contains paths designed for use within the admin area, If you want to use it on the front end you need to add something similar to the following to your head:
See #6453