HTML / CSS - How do I embed external fonts (files) into an html page without referencing as a separate file? - html

I have a template used for an email that I originally have linked to external font files in my testing environment.
This email template relies upon custom fonts which I want to load into an email html page. Initially I load them into the file using a file link.
However, when I use this in an email, I will not be able to refer to the external file.
Is it possible to embed the font file into the html page without relying on loading it as a separate file from css, preferable without using a public link on the web?

Related

How can I insert / upload an external html file to wordpress?

This may be asked before but I couldn't find any answer which is directly related to my question.
I have a web site using wordpress theme. I want to insert an external html file to the site but I couldn't find anyway to do that.
Note: Just copying the html code doesn't work. The external html file is an R Markdown document created in RStudio. So I must find a way to directly upload it.
You should create a page and paste there your html code
Create a page on the wordpress dashboard (i.e example)
The default appearance of the pages is generated by page.php file located in /wp-contents/themes/YOUR THEME/ folder. Create a php file page-example.php in this folder and paste your html code
When you'll go to this page you'll see the htm code
You have to use Custom Page Template where you can add your own HTML code. After that you just have to choose your page template while creating a page.
Take a look this link to read more about custom page templates.

Add image data to html file?

My goal is to create one HTML file, that contains everything that it needs for it's proper functioning.
I've added my .css's content to the html head between <style> tags, my javascript just before the closing body tag between <script> tags, but how can I do the same thing with my images?
The "img" tag's "src" obviously won't work if I copy my HTML to another computer.
Any suggestions?
Convert image to base64 (however it is not recommended for large images)
For example
<img src="data:image/gif;base64,R0lGODlhPQBEAPeoAJosM//AwO/AwHVYZ/z595kzAP/s7P+goOXMv8+fhw/v739/f+8PD98fH/8mJl+fn/9ZWb8/PzWlwv///6wWGbImAPgTEMImIN9gUFCEm/gDALULDN8PAD6atYdCTX9gUNKlj8wZAKUsAOzZz+UMAOsJAP/Z2ccMDA8PD/95eX5NWvsJCOVNQPtfX/8zM8+QePLl38MGBr8JCP+zs9myn/8GBqwpAP/GxgwJCPny78lzYLgjAJ8vAP9fX/+MjMUcAN8zM/9wcM8ZGcATEL+QePdZWf/29uc/P9cmJu9MTDImIN+/r7+/vz8/P8VNQGNugV8AAF9fX8swMNgTAFlDOICAgPNSUnNWSMQ5MBAQEJE3QPIGAM9AQMqGcG9vb6MhJsE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PjhIB94v/wRoRKQWGRHgrhGSQJxCS+0pCZbEhAAOw==">
To convert image to base64, you can use HTML5 canvas toDataUrl.
Just upload your images to the site imageBB copy the source link paste it into your HTML file. This way the images will be loaded directly from the server and you don't need to copy the images in every system you need to load your site.
Pros:
1)You can load the image from the server directly.
2)No need to copy the images repeatedly in every system
cons
1) The system which you want to load the site needs to have an internet connection.

Sitecore and HTML files

We have a bunch of files (css, js, html, flash, swf, etc) put together by a third party to show videos on our site. This link is an example of the type of rendered output that i'm talking about - http://www.esi-intl.com/public/us/resources/virtualclassroom/presentation.htm. This isn't my company but I was able to find this via google since our site is not live yet.
Our editors would like to include these files in the Media Library and display these pages from there. I've tried to include these files but the HTML page doesn't render instead it is offered as a download. I've tried commenting out the Mime type in the Mimetype config file but I'm not having any luck.
Can the Sitecore media handler be modified to get these HTML files to render as pages?
Thanks
Html in media libary could.
To get the correct mime-type look at the setting name="Media.RequestExtension" set the value to "" then you get the original extension.
That makes things become easier for the web server to give the correct mime type.

Is it possible to dump pure HTML dom with Chrome?

Usually HTML pages contain scripts and styles and may also reference them in separate files. How can I dump the pure HTML into a static html file with scripts removed and styles merged into html? So that I can view the page with a static html file.
You can use this extension from the crhome webstore called SingleFile.

Create a document with embedded images

I'm trying to create a document (i.e. .doc,.html) with embedded images with objective-c.
The images are stored locally on the iPhone.
For example, I've created an html using img tag and the file uri scheme. Then I saved the html code on a .doc file. But the images are not displayed.
The same thing happens if I save the html code as an .html file.
[body appendString:#"<img src='"];
[body appendFormat:#"file:/%#", absolutePath];
[body appendString:#"' />"];
where absolutePath is the path of the image on the device (I printed it and it's right).
Any suggestion?
Unfortunately you can't link to local files in HTML directly. There is a trick however: using a local substitution cache that redirects the download of the image and returns a local image instead. If the code creating the document and the cache both agree on what URL points to which image, you can get local images to appear in your HTML.
Refer to this excellent blog post to learn about how to implement such a substitution cache: http://cocoawithlove.com/2010/09/substituting-local-data-for-remote.html