Ok, that is a parser bug. The parser should not parse (and thus not translate) anything between <script> and </script>
Could you please open an new issue on the bug tracker with the description below ? https://savannah.gnu.org/projects/wget/ Thank you. Tim On Tuesday 18 August 2015 09:50:10 Murali Ramanujam wrote: > Hi > > Sorry for the initial confusion. > I have the following script tag in the original web page. > > <script> > var loc = "script.js"; > document.write("<script src=" + loc + "><\/script>"); > </script> > > When I save it using wget -k -p, the corresponding saved file has the > following script tag > > <script> > var loc = "script.js"; > document.write("<script src="http://localhost/+ loc +"><\/script>"); > </script> > > > The script tag written by document.write is expected to be “script.js” but > wget saves it as “http://localhost/+loc+” > Wget is trying to rewrite the link for scripts written by document.write > which is not supposed to happen. > > Thanks > Regards, > Murali > > On Mon, Aug 17, 2015 at 10:16 PM, Ander Juaristi <[email protected]> wrote: > > On 08/17/2015 05:04 AM, Murali Ramanujam wrote: > >> Hi > >> > >> > >> When I try to save the attached HTML page (original.html) with wget -k > >> -p, the resource path gets mangled in the rewrite process (saved.html is > >> output of wget). > > > > If I understood you well, you execute > > > > wget -k -p http://localhost/original.html > > > > and get a file called 'saved.html' as a result?! > > > > What do you mean with "resource name is in a variable"? What's the exact > > command you executed on the console? > > > >> The saved page gives a SyntaxError error when opened. In addition, it > >> looks like wget is trying to rewrite the src to http://localhost/loc but > >> it should be http://localhost/script.js. > >> > >> > >> Script.js is just console.log(1); > >> > >> > >> Is this a valid bug? Is there any way to get expected behaviour from wget > >> in such a situation? > > > > Could you pass the flag '--debug' and post the output? > > > >> Thanks > >> Murali > > > > Regards, > > - AJ
signature.asc
Description: This is a digitally signed message part.
