How to link to an HTML file without it rendering as HTML


#1

Hello guys!

I already know the basics of linking to other pages, but what if I want to link to an HTML-file without it rendering as a site? I just want the raw code.


#2

Are you asking about Atom, the text editor, or Electron, the application framework?


#3

I guess it would be the text editor. I don’t understand anything about Electron. :joy:
my code is this:

<form action="some_file.html">
<input type="submit" value="my HTML code">
</form>


I actually have this scheme 3 times, with JavaScript and CSS code as well, but they don’t render.


#4

This isn’t an Atom question at all. It’s a question about HTML and JavaScript. We might be able to give you an answer, but we need more information about what you’re attempting.

  1. What reason do you have to believe that the code you posted will display your code?
  2. What purpose do you intend to accomplish by displaying the raw code?

#5

Well, I don’t really believe it’s going to show, I’ve already tried many ways.
I just want a way for it to show.

Secondly, I’m making a sort of informative website, learning to code. I want to be able to place links to certain codes to practice, including HTML pages. But of course, they load immediately like a normal web page.


#6

Head over to MDN and read their information about the pre and code tags.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/code
Hopefully you’ll be able to get the results you want.


#7

It’s possible to load a page into a variable with JavaScript, then print that onto the page wrapped in <pre> or <code> tags so that it doesn’t get rendered. Directions are here, but if you’re brand new, it might be more advanced than what you should be focusing on. That’s why I asked what your intention was.