0

I have img tag used in my website which loads click tracking.

By using img tag, web browser automatically loads the resources specified by src attribute and its related resources.

Now my problem is, I cannot use img tag anymore but I still need to achieve the some function. Does anyone know what html tags can do the same thing as img does?

Thanks

Davidson Sousa
  • 1,353
  • 1
  • 14
  • 34
Franva
  • 6,565
  • 23
  • 79
  • 144
  • 4
    You could try giving the div a background image? And setting the onclick for the div. – 100pic Jun 06 '16 at 23:52
  • 1
    As @100pic mentioned... Any element can be utilised for this. a Div or Span would be the most obvious choice. You will need to specify the width and height of the container with css, then set the background property as an image. – Aaron Lavers Jun 07 '16 at 02:00

1 Answers1

1

Depending on what type of image is being used (.jpg, .png, .svg) you could also use <object> or <embed>.

As 100pic mentions, it'd probably be easier to nest the image in a <div> and have the onClick tracking happen on that.

Sven Schoenung
  • 30,224
  • 8
  • 65
  • 70
TimJK
  • 26
  • 4
  • 1
    http://stackoverflow.com/questions/4476526/do-i-use-img-object-or-embed-for-svg-files Forgot to add link – TimJK Jun 06 '16 at 23:59