Write javascript output to file on server

后端 未结 3 703
感情败类
感情败类 2020-12-16 08:56

So I have this HTML file that tests the user\'s screen resolution, and plugins installed using Javascript. So when the user accesses the page it sees: (e.g.) Your current sc

3条回答
  •  清酒与你
    2020-12-16 09:19

    Do you know jQuery? It will be much easier with jQuery.

    var data = "";
    for (var i=0; i < num_of_plugins; i++) {
       var list_number=i+1;
       document.write("Plug-in No." + list_number + "- "+navigator.plugins[i].name+" 
    [Location: " + navigator.plugins[i].filename + "]

    "); data += "Plug-in No." + list_number + "- "+navigator.plugins[i].name+"
    [Location: " + navigator.plugins[i].filename + "]

    "; } $.post('savedata.php', {data=data}, function(){//Save complete});

    Then in savedata.php you can write something like the following:

    $data = $_POST['data'];
    $f = fopen('file', 'w+');
    fwrite(f, $data);
    fclose($f);
    

提交回复
热议问题