1

I'm trying to reference a image that is in the same folder has the .js but call it on any page of my php/wordpress page.

So the .js is in http://www.example.com/wp-content/themes/includes/demo/facebox.js and the image is on http://www.example.com/wp-content/themes/includes/demo/closinglabel.png

but I'm referencing the js in the front page and on other pages basically www.example.com. This is basically a fix for facebox because it won't let me autoload while picking my hrefs. Can in .js find the path to the current .js location?

Dan
  • 183
  • 3
  • 14

1 Answers1

0

I recommend referencing the image with a site-relative URL (one that begins with a /) then the image should work on any page of any domain that you use, so long as the domain has the same file system paths or/and rewrite rules.

Also, an answer to your secondary question can be found here: What is my script src URL?

Community
  • 1
  • 1
ghbarratt
  • 11,496
  • 4
  • 41
  • 41