Fetch complete page including head
In the context of the plugin "
Ajaxify ", I'm pre-processing the whole HTML, including the head of any target page, returned by an
- return String(h).replace(docType, "").replace(tagso, div12).replace(tagsc, "</div>")
...where:
- h is the HTML fetched by the Ajax request
-
div12 = '<div class="ajy-$1"$2'
and the others are RegEx's:
- docType = /<\!DOCTYPE[^>]*>/i,
- tagso = /<(html|head|body|meta|script|link)([\s\>])/gi,
- tagsc = /<\/(html|head|body|meta|script|link)\>/gi
...because older versions of jQuery required such pre-processing, before dumping the HTML into a jQuery selector.
Is this technique still needed?
(e.g. from jQuery 3.0)
I've researched this before, but it doesn't seem to be your everyday question?
Thanks in advance!