Using VB.NET in Visual Studio 2010, I have two files:
"test2.aspx" and "test2.aspx.vb".
The aspx file is basically as follows:
<%# Page Language="VB" AutoEventWireup="false" CodeFile="test2.aspx.vb" Inherits="App_test2" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta id="meta1" runat="server" name="description" />
</head>
<body>
<textarea id="text1" runat="server" />
</body>
</html>
The vb file is basically like this:
meta1.Attributes("charset") = "UTF-8"
meta1.Attributes("content") = "I'm a description tag"
text1.InnerText = "&'<>"
This all displays as expected in the browser, but the source code when the page is rendered looks like this:
<html>
<head>
<meta id="meta1" name="description" content="I'm a description tag" charset="UTF-8"></meta>
</head>
<body>
<textarea name="text1" id="text2">&'<></textarea>
</body>
</html>
Is there something I can do so the source code doesn't escape characters like "&", "'", "<", and ">" ?
You don't. If it didn't convert those characters, the browser would incorrectly interpret them as commands instead of data. It shouldn't be an issue for you because it is always converted back to the character data in code. text2.Text would contain the values you want, not the escaped data.
Related
I am trying to implement html like template in pug with
#{name}
but this is not working it double prints it then I use pipeline character
|#{name}
but its output is <h1>This Is Content<h1>
my full template is
<html lang="en">
<head>
SomeRandomStuff
</head>
<body>
|#{Content}
</body>
Scripts
</html>
Use !{name} instead.
<html lang="en">
<head>
SomeRandomStuff
</head>
<body>
!{Content}
</body>
Scripts
</html>
See docs here.
I'm trying to deal with a strange behavior of G+ sharing.
I wrote two lightweight HTML pages to demonstrate my problem. Those pages are almost identical except images in their bodies. On the first page, the content image is much larger that the og:image. On the second page, the content image is slightly smaller than the og:image.
First HTML page:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta property="og:title" content="Test page" />
<meta property="og:description" content="This is page for G+ strange behavior testing." />
<meta property="og:image" content="https://upload.wikimedia.org/wikipedia/wikimania2014/thumb/e/e2/Ask-Logo-Small.jpg/250px-Ask-Logo-Small.jpg" />
<title>Test page</title>
</head>
<body>
<div>
<p>Hello world!</p>
<img src="https://upload.wikimedia.org/wikipedia/commons/3/3f/Fronalpstock_big.jpg" />
</div>
</body>
</html>
Second HTML page:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta property="og:title" content="Test page" />
<meta property="og:description" content="This is page for G+ strange behavior testing." />
<meta property="og:image" content="https://upload.wikimedia.org/wikipedia/wikimania2014/thumb/e/e2/Ask-Logo-Small.jpg/250px-Ask-Logo-Small.jpg" />
<title>Test page</title>
</head>
<body>
<div>
<p>Hello world!</p>
<img src="http://previewcf.turbosquid.com/Preview/2014/07/05__19_56_51/01.jpg90ddaa05-e3a9-4607-b466-29ade8412934Small.jpg" />
</div>
</body>
</html>
The problem is that in the first case, G+ shows the image from the body (ignores og:image). In the second case, G+ shows og:image as expected.
I've also tried using schema microdata, but the behavior is the same.
I share pages using https://plus.google.com/share?url=PAGE_URL.
Solved! The reason was that in the second case, the og:image had smaller width than G+ requires.
I have a source code use manifest. When i run code in chorme it work. But when i run in ie 10 AppCache Fatal Error.
Code html:
<html manifest="demo.manifest">
<head>
<meta charset="utf-8" />
<meta http-equiv="EXPIRES" content="0" />
<meta http-equiv="PRAGMA" content="NO-CACHE" />
</head>
<body>
<script src="js/jquery.min.js"></script>
<p id="timePara"><button onclick="getDateTime()">Get Date and Time</button></p>
<p><img src="imgs/img_logo.gif" width="336" height="69"></p>
<p>Try opening this page, then go offline, and reload the page. The script and the image should still work.</p>
</body>
</html>
And code manifest file:
CACHE MANIFEST
js/demo_time.js
imgs/img_logo.gif
Some body help me. Thank you for support.
For better SEO I need put some meta on my page like this:
<!-- Schema.org markup for Google+ -->
<meta itemprop="name" content="The Name or Title Here">
<meta itemprop="description" content="This is the page description">
<meta itemprop="image" content="http://www.example.com/image.jpg">
Here is the source.
Then I check this code on Markup Validation Service:
<!DOCTYPE html>
<html>
<head lang="en">
<meta itemprop="name" content="The Name or Title Here">
<meta itemprop="description" content="This is the page description">
<meta itemprop="image" content="http://www.example.com/image.jpg">
<meta charset="UTF-8">
<title>My title</title>
</head>
<body>
My body.
</body>
</html>
Throwing this error:
Line 4, Column 57: The itemprop attribute was specified, but the element is not a property of any item.
<meta itemprop="name" content="The Name or Title Here">
Line 5, Column 70: The itemprop attribute was specified, but the element is not a property of any item.
<meta itemprop="description" content="This is the page description">
Line 6, Column 68: The itemprop attribute was specified, but the element is not a property of any item.
<meta itemprop="image" content="http://www.example.com/image.jpg">
How can I fix this?
You should explicitly provide a type these properties (name, description, image) belong to.
In Schema.org, everything is a Thing. Thing has many child types, listed under "More specific Types". Start there and choose the most specific type for your content.
For example: WebPage, Article or maybe BlogPosting.
It could look like (using WebPage as example here):
<html itemscope itemtype="http://schema.org/WebPage">
If you use itemprop meta tag in header for your site title, description and so on.
only just add itemscope itemtype="http://schema.org/WebPage" in your html tag.
Usage:
<html itemscope itemtype="http://schema.org/WebPage">
I would like to have static Titles in my code for different pages.
How would i go about this, it keeps using the app name in the title.
I have tried
1)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Site under construction</title>
</head>
<body>
<p id="notice"><%= notice %></p>
<p>
<b>Title:</b>
<%= #page.title %>
</p>
<%= link_to 'Edit', edit_page_path(#page) %> |
<%= link_to 'Back', pages_path %>
</body>
</html>
That did not work
I have tried rails page titles
not working is there something i am missing here.
I assume that is the contents of your view. The default rails project creates a layout that has the application name in the title element. Therefore, you are likely to have something not dissimilar to the following being sent to the browser:
<!DOCTYPE html>
<html>
<head>
<title>Sample application</title>
</head>
<body>
<div>
<!DOCTYPE html PUBLIC "…" SYSTEM "…">
<html>
<head>
<meta …/>
<title>Site Under Construction</title>
</head>
<body>
…
</body>
</html>
</div>
</body>
</html>
The file you need to edit should be app/views/layouts/application.html.erb