Jump to content

Opening and saving code

Recommended Posts

At the moment, when I use the URL given when HTML code is saved on the tryit board, it does not load up again.

In a similar fashion, any code written on the tryit board cannot be saved, you just get a loading icon spinning endlessly and the URL does not appear.

Any help woupd be appreciated!


Link to post
Share on other sites

Yes. We are suffering the same problems.

(1) Unable to save HTML pages now.

(2) Saved HTML/JavaScript codes are gone (past links cannot bring back our codes.)

The site seems to have physical storage problems for the past few days.

Please help us to resolve the problems asap.


Link to post
Share on other sites

The following codes, which was directly copied from tryit editor source with alert()'s show that the php server codes does not accept saved data correctly now.

globalURL = 'https://tryit.w3schools.com/code_datas.php';


<!DOCTYPE html>
<title>Simulation SaveFile of TryIt Editor</title>
<div id="preSave">preSave</div>
<div id="errorSave">errorSave</div>
<div id="postSave" style="color:red">postSave</div>
<button onclick="saveFile(`document.getElementById('textareaCode').value`)">saveFile</button>
<a id="shareLink" style="color:red" href="javascript:void(0);">shareLink</a>
<div id="shareLinkText" style="color:red">shareLinkText</div>
<div id="saveLoader" style="color:red">saveLoader</div>
<div id="saveModalSaved" style="color:red">saveModalSaved</div>
globalURL = 'https://tryit.w3schools.com/code_datas.php';

function saveFile(code) {

    if (code.length>20000) {
    var paramObj = {};
    paramObj.code = code;
    var paramB = JSON.stringify(paramObj);
    alert('paramB= ' + paramB);
    var httpB = new XMLHttpRequest();
    httpB.open("POST", globalURL, true);

    httpB.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

    httpB.onreadystatechange = function() {
        alert(httpB.readyState + httpB.status);
        if(httpB.readyState == 4 && httpB.status == 200) {

            if(httpB.responseText.substr(0,2) == "OK" ) {
              var getId = httpB.responseText.substr(2);
              document.getElementById("shareLink").href = "/code/tryit.asp?filename=" + getId;
              document.getElementById("shareLinkText").innerHTML = "https://www.w3schools.com/code/tryit.asp?filename=" + getId;
              document.getElementById('saveLoader').style.display = "none";
              document.getElementById("saveModalSaved").style.display  = "block";
            } // "OK"
        } // 4 && 200
    } // onreadystatechange

<h1>This is a test/simulation on W3Schools saveFile() function</h1>
<p>Post to <script>document.write(globalURL);</script> is being tested.</p>
<p style="color:red">Status codes: 202, 203, 204 are returned</p>
<p>204: Empty Content. Server successfully executed request but without return anything.</p>


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...