Asked  8 Months ago    Answers:  5   Viewed   41 times

What approach could someone suggest to save the current page as an HTML file to the server? In this case, also note that security is not an issue.

I have spent endless hours searching around for this, and have not found a single thing.

Your help is much appreciated, thank you!


Thank you all for your help, it was very much appreciated.



If you meant saving the output of a page in a file, you can use buffering to do that. The function you need to use are ob_start and ob_get_contents.

// Start the buffering //
Your page content bla bla bla bla ...

echo '1';

// Get the content that is in the buffer and put it in your file //
file_put_contents('yourpage.html', ob_get_contents());

This will save the content of the page in the file yourpage.html.

Wednesday, March 31, 2021
answered 8 Months ago

IE8 does not support HTML5. Perhaps IE9 is running in compatibility mode? Press F12 to bring up the developer tools and in the top menu you can change the settings in what mode it is in.

Maybe it is a solution to use a Java or Flash based system for multiple uploads. Also, these will also usually support drag and drop of files.

Wednesday, March 31, 2021
answered 8 Months ago

Two things:
1. Is the form set to:

<form method="POST" enctype="multipart/form-data" action="INSERT ACTION">

2. Is the folder your posting the file to, is it set to 777?

Wednesday, March 31, 2021
answered 8 Months ago

You can use document.getElementById("myID").innerHTML, like this:

var = tabelaContent; 

tabelaContent = document.getElementById("tabela").innerHTML
Wednesday, October 20, 2021
answered 1 Week ago

There are some solutions out there, like for example display property toggle, or render inside hidden element.

Solution 1

Quickly toggle visibility property

const el = document.querySelector('.specific'); = "block"; // or any other property, like opacity, visibility...
html2canvas(el, {...}).then((canvas) => { = "none";

Solution 2

Wrap your div (and make it visible) inside an invisible wrapper

<div style="position: absolute; opacity: 0; pointer-events:none;">
    <div class="specific"></div>


<div style="overflow: hidden; height: 0;">
    <div class="specific"></div>

Solution 3

Using html2canvas onclone callback function you can modify object passed to renderer (I think it's the best solution)

html2canvas(document.querySelector('.specific'), {
    onclone: function(doc){ = 'block';
        // or = '1', = 'visible' ...
    onrendered: function(canvas) {
        theCanvas = canvas;
Saturday, October 23, 2021
Martin Thoma
answered 5 Days ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :