HTML elements that could trigger an HTTP request
Asked Answered
A

1

15

Given a web page, I would like to detect:

  • Which elements in the page might trigger an http request?
  • For those elements, I would like to know what is the http method (POST, GET, etc.) of the relevant request.

I'm assuming this is a tough question.. but are there any indicators that could hint for one option or another?

Archducal answered 16/6, 2016 at 8:12 Comment(2)
http requests can be triggered manually or automatically. Elements like <img/>, <iframe/>, <video/> will trigger an automatic request. Tags such as <a/> and '<input type="submit"/>' can be triggered manually. Pretty much any element can trigger an AJAX request depending on how the JS is implementedSpherulite
The standard list would include anything with a src or href attribute; however a <style> element with a url(...) somewhere inside it might as well. <script> elements are completely open game. The potential list is quite wishy washy and long.Hyperacidity
A
9

I would say any element having an attribute of type URI will be capable of trigerring an HTTP request, and also any element having an attribute if type script can trigger it through javascript.

We could filter that out from this list: https://www.w3.org/TR/REC-html40/index/attributes.html

and based on the accepted answer for this question: COMPLETE list of HTML tag attributes which have a URL value?

This gives you the list with attributes of type url (see my quoted answer below).

As for script type attributes, that includes onclick, onkeypress, etc which means, I believe you would be left with a hand full of elements which are not going to be able to trigger an http request if that.

Quoting the answer:

Check out the W3C's list of HTML attributes, there's a "type" column in there and just look for URI types.

And of course the HTML 5 version of that list is useful too

So for HTML4 we've got:

  • <a href=url>
  • <applet codebase=url>
  • <area href=url>
  • <base href=url>
  • <blockquote cite=url>
  • <body background=url>
  • <del cite=url>
  • <form action=url>
  • <frame longdesc=url> and <frame src=url>
  • <head profile=url>
  • <iframe longdesc=url> and <iframe src=url>
  • <img longdesc=url> and <img src=url> and <img usemap=url>
  • <input src=url> and <input usemap=url>
  • <ins cite=url>
  • <link href=url>
  • <object classid=url> and <object codebase=url> and <object data=url> and <object usemap=url>
  • <q cite=url>
  • <script src=url>

HTML 5 adds a few (and HTML5 seems to not use some of the ones above as well):

  • <audio src=url>
  • <button formaction=url>
  • <command icon=url>
  • <embed src=url>
  • <html manifest=url>
  • <input formaction=url>
  • <source src=url>
  • <video poster=url> and <video src=url>

These aren't necessarily simple URLs:

  • <object archive=url> or <object archive="url1 url2 url3">
  • <applet archive=url> or <applet archive=url1,url2,url3>
  • <meta http-equiv="refresh" content="seconds; url">

In addition, the style attribute can contain css declarations with one or several urls. For example: <div style="background: url(image.png)">

Athens answered 16/6, 2016 at 8:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.