Fetch complete page including head

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

$.ajax()

...request like this:

  
  1. 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:

  
  1. docType = /<\!DOCTYPE[^>]*>/i,
  2. tagso = /<(html|head|body|meta|script|link)([\s\>])/gi,
  3. 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!