I'm using the AIR HTML control and I want to pass in a full HTML page string. A full HTML page simply meaning that the HTML markup has HTML begin and end tags. It looks like htmlText property accepts HTML formatted markup but might not be built to accept a full HTML page. A HTML formatted markup would be something like this:
<p>This is a paragraph. Here is <b>bold</b> text.</p>
Here is a full HTML page example:
<html>
<body>
<p>This is a paragraph</p>
</body>
</html>
Or would it be better to write the page to the file system and then load it through the location property? One thing to note is that I could be updating the HTML page a lot so I would like to avoid writing to the file system if possible.
Related
so I have this huge amount of text from several documents that i'd like to insert on my webpages. When i copy paste the text into my <p>element, it works fine and all, but it looks messy in my html-file.
Is there any other way to transfer my written document to my html-file, for instance link the document to the html-file, or maybe there's a way to hide or separate the <p> so the html-file looks neat even though there's a huge amount of text in my html-file. Any advice?
I do not know about any way to include html in another html (something like php's include), but it could be done with JQuery:
index.html:
<html>
<head>
<!-- link jquery -->
<script>
$(function(){
$("#fileContent").load("doc.html");
});
</script>
</head>
<body>
<div id="fileContent"></div>
</body>
</html>
doc.html (file that contains your text)
There's a lot you could do to separate these blocks of text.
Firstly, I'd recommend using <div>..</div> tags to divide the content into separate semantic sections. There are a bunch of different tags that aim to divide the content of the page semantically: <aside>, <main>, <header>, <nav>, and so on. I'd recommend reading up on these tags and using them appropriately.
However, to answer your question more directly, you should separate each block of text into separate <p> tags. After all, the <p> tag is meant for defining separate paragraphs. While the HTML document may not look pretty when indented and filled with multiple different tags like <div> a <p>, it is the best way to do it.
Unless the HTML page is going to be presented in its core (code) format, then how the <p> tags look in the .html file is unnecessary because after all these are what define how the page is presented and rendered in the browser.
I'm creating a node app with mongodb.
I'm using TinyMCE in textareas for input. When I save it to the database and want to show it somewhere on a page, I see the HTML Code (<p>This is a paragraph</p>) instead of the actual rendered HTML.
When I console.log() the item from the ejs file I get this:
<p>Hello</p>
<p>I was here:</p>
<p>Link</p>
But when I look into the source code of the page I see this:
<p>I was here:</p>
<p>Link</p>
Any ideas?
So here is the solution:
In ejs there is the <%- for unescaped values, which I forgot.
https://ejs.co/#docs
Now i have the footer and header of the main page copied in every page of my site, is there a way to set it somehow to update on every page each time i modify it on index, or to get it from an external source?
For a more advanced approach, you can simply use PHP Includes or Requires.
include ‘filename’;
or
require ‘filename’;
The filename’s will simply be your header and footer pages. I’ll show you an example to get the idea.
Let’s say we have a footer and it looks like this:
<?php
echo “<p>Copyright of Brian. SO
1994-“.date(“Y”).</p>”;
?>
Now be mindful that, like always, you can add attributes to the paragraph in your footer and header and even call style sheets that can style those paragraphs or whatever you’ve got in you footer or header.
Now, to have your page(s) display the footer or header that you’ve made, and in your case, both; simply use the format shown here:
<html>
<body>
<h1>Welcome to my Homepage!</h1>
<p>Some text.</p>
<p>Some more text.</p>
<?php include ‘footer.php’;?>
</body>
</html>
Now, notice that in my example, my footer file is in a .php format rather than an .html, that’s because my footer example contained a PHP specific function to render the current year. If yours is strictly HTML with a CSS style sheet linked to it, simply type ’footer.html’; or whatever your file name is. The header works the same exact way!
You can’t do this with plain HTML. You may use jquery or javascript frameworks though.
Follow this solution here: https://stackoverflow.com/a/18712605/3086531
I am working with a html project and my task is to discribe html with facts and examples.
How do i write this example so i just get the text on my website?
<p>(The text between and describes the web page, and the text between and is the visible page content. The markup text "This is a title" defines the browser page title.)</p>
You can use "entities": <for < and >for >
So a <p> tag would be written as <p>
Example: http://codepen.io/anon/pen/bqqObp
I'm curious as to exactly what the flexibility is for the html5 <object> tag.
If I have a main web page set up like this
<body>
<div id="container">
<object data="??"></object>
</div>
</body>
and in a separate webpage I have this:
<body>
<div id="info">
<p> text text blah blah text </p>
</div>
</body>
Is there a way to pull specifically the html from the "info" div on the secondary page into the object on the primary page? If not, what kind of alternative solution should I look into?
object is not an HTML5 specific tag, it also existed in HTML 4.01. It is not useful for including pages into other pages, rather it allows the page to contain Java Applets, Flash etc. The only HTML solution for including pages is the iframe tag.
You should instead insert some JavaScript that makes an AJAX call to fetch the second page. Parse it using innerHTML. Then you can select the desired element using getElementById and insert it into the container div.
If you want to do it from the server side, have a look at PHP...