 <p>If you want to save modified source as html you can use different aproaches, depends on what you want to mainupulate. Sadly with javascript saveing file is tricky and depends on many things, so you could use option to copy paste file source manually or write your browser and settings specific file saver. I would prefer javascript+php combo solution. Or if there is no need to manipulate someting with javascript i would do it entirely in php.</p> <p>Step 1 - open browser with console, in chrome and firefox CTRL+SHIFT+J And allow popups. Step 2 - open webpage you want Step 3 - Copy next code to console</p> <pre><code>//Script loading function function load_script( source ) { var new_script = document.createElement('script'); new_script.type = 'text/javascript'; new_script.src = source; new_script.className = 'MyInjectedScript'; document.getElementsByTagName('head')[0].appendChild(new_script); } function escapeHtml(unsafe) { return unsafe .replace(/&amp;/g, "&amp;amp;") .replace(/&lt;/g, "&amp;lt;") .replace(/&gt;/g, "&amp;gt;") .replace(/"/g, "&amp;quot;") .replace(/'/g, "&amp;#039;"); } //Load jQuery, if page do not have it by default if (typeof(jQuery) != 'function') load_script('http://code.jquery.com/jquery-latest.js'); </code></pre> <p>Step 4 - Do your manipulations in console</p> <p>Step 5 - Copy next code to console</p> <pre><code>//In the end remove your injected scripts $('.MyInjectedScript').remove(); //Or jquery script will be in source //get Document source var doc_source = $('html',document).html(); doc_source = '&lt;html&gt;'+doc_source+'&lt;/html&gt;'; var new_window = window.open('', '', 'scrollbars=yes,resizable=yes,location=yes,status=yes'); $(new_window.document.body).html('&lt;textarea id="MySource"&gt;'+escapeHtml(doc_source)+'&lt;/textarea&gt;'); </code></pre> <p>STEP 6 - copy paste code from opened window textarea</p> <p>If you want to do it with PHP you can easily download page with curl and manipulate content and save file as desired.</p>