Which HTML5 attributes can be a URL? [duplicate] - html

This question already has answers here:
COMPLETE list of HTML tag attributes which have a URL value?
(2 answers)
Closed 7 years ago.
Obviously a href and img src. Are there any others? How would you search for this?

One of them is certainly srcset on the picture element, well its contains a URL but is maybe one.
Not sure how to properly search for one, maybe browsers have implemented some logic like that?
Mh, at least servo has implemented a generic get_url_attribute function which tries to converts any attribute to a URL https://github.com/servo/servo/blob/master/components/script/dom/element.rs#L997 sorry no help here

Related

How would I parse multiple variables through a dynamic link in html? [duplicate]

This question already has answers here:
Passing multiple variables to another page in url
(8 answers)
Closed 2 years ago.
This may be a relatively simple answer, although I can't seem to find any solution online.
I've been parsing a variable through a dynamic link by using the following line:
a href="play.php?inputType=album"
inputType being the variable I want to parse. Although I also want to parse another variable through the hyperlink although I'm not sure if or how I can add it to the url.
Multiple parameters can be passed through the URL by separating them with multiple "&". Here is an example of the same:
<a href="play.php?inputType=album&name=test">

Regex to find all anchor tag links [duplicate]

This question already has answers here:
Why is it such a bad idea to parse XML with regex? [closed]
(3 answers)
Closed 4 years ago.
Just to get this out of the way from the start, I have read that question, and I totally get that generally it's a bad idea, and that there are other better ways.
However, for my very simple use case, which is to retrieve all the anchor tag links on a page, I would've thought the following regex would suffice, and be far simpler and faster than a full blown HTML parser:
href="(.+)"
Now, am I overlooking some obvious fatal flaw, or would this be a good enough option for my very simple use case?
Answer: No, it’s a bit more complicated than that.
Why? That will likely grab more than the anchor tag links because href is used for more than just anchor tags. See this page for some examples.
There may also be tags with an href attribute which are commented out in the HTML.
Also, it could be in a JavaScript string for elements that get dynamically added to a page such as
var newElement = 'My Page
There are quirks you’d need to account for such as the ones mentioned in the comments by LGSon and Daniel Gale, amongst others, but this is probably enough to answer your question - no, it’s not that simple.

How can I write my own tags? I want to write something like div/span or any other html tags [duplicate]

This question already has answers here:
Is there a way to create your own html tag in HTML5?
(18 answers)
Closed 6 years ago.
I don't want it to be specific to one project, I am looking for any way to write a tag which can be used globally?
I don't want something like :
richa {...styles} [Style.css]
<richa>Contents </richa> [index.html]
I want to write it the way, div/span etc are written to be used globally.
How do I do that?
Please follow the link for your query.Hope this will help, let me know if this is working for you.
Is there a way to create your own html tag in HTML5?

How do put a code well in my website? [duplicate]

This question already has answers here:
How to display HTML tags as plain text [duplicate]
(11 answers)
Closed 9 years ago.
I'm currently creating a website and I need to show an example of code on the page. simply putting it within a p obviously doesn't work, as the tags do not display. Is there anyway to get them to display on the webpage?
You can put code in <code> tags (if what you're displaying is in a programming language) just to get something going quickly. If what you're displaying is Markup (HTML), you'll have to replace < with < and > with >.
You can also look at tools like SyntaxHighlighter if you want your code to be more readable.

Setting input control focus without javascript [duplicate]

This question already has answers here:
Default html form focus without JavaScript
(5 answers)
Closed 8 years ago.
Is there a way to set the focus in a specific HTML input (a textarea control, actually), without using Javascript?
EDIT: Is possible in HTML5 but the question is about HTML < 5
You can use autofocus in HTML5 documents, but it has little support at present (see chart).
Nope. Sadly JavaScript is required, because it's dynamically modifying the browser on the client-side (what JavaScript was made for).
I don't know of any, other than tabbing to the field or clicking within it.
It depends on how and when you want to set the focus on this textarea. "tabindex" might help you.