Hi All,
I'm trying to insert an HTML <base> tag immediately after the opening <head> tag of a page using dom. I've tried using appendChild which just inserts it before the </head> which is no good.
Code im using:
$head = $dom->getElementsByTagName('head')->item(0);
$base = $dom->createElement('base');
$base->setAttribute('href', $url);
$head->parentNode->insertBefore($base, $head);
This inserts the <base> tag before the <head>, which is still no good!
Any ideas? Beer for the correct answer!