Announcement

Collapse
No announcement yet.

HTML query

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    HTML query

    I used to have a website that I built from scratch. I still have the HTML files I created back then. If I double click on the index.html file, the Chrome browser opens, and it displays my old home page.Today I created in Writer a test document, and I saved it as an HTML document, but I did not write into that file any HTML code. I used Dolphin to find that saved file, and I double clicked on it. Result:Chrome opened a tab, and it showed the file’s content as a web page. I then went to Chrome’s Tools menu, and I selected the View Source option. The source code behind that web page then displayed in Chrome. I copied that source code to the clipboard, and I opened a Writer Document and I pasted the source code into that document. Then I saved the file with this name: HTMLTestSourceCode.HTML. Then I used Dolphin to locate that file.

    I double clicked on that file, and a web page did not open. Instead Chrome opened a page, and it displayed the source code. My question: Since that file contains HTML code, and the file name ends with .HTML, why did Chrome not display the web page that that source code originally produced?
    Last edited by wtb32141; Jan 03, 2019, 01:03 PM.

    #2
    If you save a document as html in Writer, it will create a html page that replicates what you see in the document (if your document contains html code, writer will generate a html page that shows the code)...not a plain text file with the html code you have pasted. If you save the document as text (and then rename it as .html file) a web browser should show the page (instead of the page that contains the source).

    My general recommendation is: "never use a word processor (like Writer) to create html files...ever". Use a text editor (like kate) or a dedicated html editor, if you must.
    Last edited by kubicle; Jan 03, 2019, 01:48 PM.

    Comment


      #3
      I agree fully with Kublice: only advanced masochists should use a word processor for writing html. OpenOffice, LibreOffice, Word all make really horrible, horrible, horrible html.
      Apart from that: you copied that horrible begin-file a few times. With every copy there was a chance some odd character was added on some critical place. Or the opposite: something was not copied. If you look at the source code, it must be possible to find the thing that went wrong. But it's much easier to use a decent editor.
      It's also very well possible Writer (or another program used for copying) added an invisible character that gives problems.
      If you use Kate or another editor suitable for writing html, none of this problems will happen.

      Comment


        #4
        I wrote the following message before reading the 2 replies. The message is:

        I have solved my problem. This morning I discovered gedit. So I did the same thing that my first post describes except this time I pasted the copied source code into gedit and saved it in a new file with gedit in the file name so that I would know that gedit produced that file. Then I used Dolphin to locate that new file. I double clicked on that file, and lo and behold, a web page opened.

        Granted,gedit is just a plain text editor and Writer isn’t. But why does Writer let one create an HTML document if the HTML code entered will not produce a web page without saving the HTML code in a text editor?

        Now I will add a comment. The procedure I used several years ago was to let Writer generate the first version of the HTML code. Then I would go into that code and simplify it. The first version that Writer produces now is far more complicated than it was several years ago.

        Thank you for your replies. You gave me sound advice.
        Last edited by wtb32141; Jan 04, 2019, 09:09 AM.

        Comment


          #5
          Kate is probably a better coding editor, but a text editor works well enough.
          The next brick house on the left
          Intel i7 11th Gen | 16GB | 1TB | KDE Plasma 5.24.7 | Kubuntu 22.04.4 | 6.5.0-28-generic


          Comment


            #6
            Another option (although not kde) is bluefish... once you turn off the multiple toolbar menus and use it as an editor it is quite nice.
            Nowadays I'm mostly Mac, but...
            tron: KDE neon User | MacPro5,1 | 3.2GHz Xeon | 48GB RAM | 250GB, 1TB, & 500GB Samsung SSDs | Nvidia GTX 980 Ti

            Comment


              #7
              I wouldn't use a normal text editor. An editor like Kate colours the code and that unbelievable useful for finding errors. Every real code editor has extended error checking, but for only html something like Kate will work too.

              Comment

              Working...
              X