Empty page in Webmatrix - webmatrix

I wrote (copied) a first program in WebMatrix. I selected EmptySite template and in Page.cshtml I typed 2 lines. Finaly, the code in Page.cshtml looks like this:
#{
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<h1>Welcome to the WebMatrix!</h1>
<p>I began to become a web developer on #DateTime.Now.ToString()</p>
</body>
</html>
I pressed "Run" but I got an empty web-page. Nothing is written on it. I received no error message.
Well, what's wrong ?
Thanx,
Eb_Cj

You seem to be going to the default document rather than your page. You can solve this in two ways: either right click on the Page.cshtml node in the project explorer within WebMatrix and select Launch in browser or manually change the URL in your browser to localhost:25776/Page.

Related

Issue with Thymeleaf th:href, the link seems not to be created and thus not clickable

I have a simple html page, "index.html". I'm testing server.servlet.context-path=/test and i'm testing on the webpage the redirection on itself, nothing more. For some reason that I can't understand, even with the docs about thymeleaf https://www.thymeleaf.org/doc/articles/standardurlsyntax.html
<a th:href="#{/index.html}">Reload page</a>
It's just displaying "Reload page" and I can't even click on it. My goal is to be able to click on it and to be redirected to /test/index.html, as I thought this would be the accurate method.
Feel free to give me any advice on how to do so, or why isn't it working the way it's supposed to be.
Thanks you very much for your time !
EDIT : Here are the dependencies thymeleaf-related I'm using :
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!DOCTYPE html> <html xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head>
<title>Test page</title>
</head>
<body>
<a th:href=#{/index.html}>Reload page</a>
</body>
</html>
This is the exact page I'm using. If I remove the xmlns in the html tag, the th:ref is marked as "Undefined attribute name (th:href)." Which made me think that when I have the xmlns (as it is right now) the attribute is correctly defined.

Dartium debugger stops working if server is used

After updating dartium to 0.4.7.1_r21548 (same for 0.5.0.1_r21823) i am unable to debug anymore. I have written a small test and discovered that the breakpoints are hit if i call the file direct. But if i use a server and call the page (http://localhost:8080/test.html) the dart code works perfectly, but the breakpoints are missed!
I am not debugging with dart-editor. Only dartium is used.
Here is my test:
test.dart
void main() {
print("hallo");
}
test.html
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test</title>
<script type="text/javascript" src="packages/browser/dart.js"></script>
<script type="application/dart" src="test.dart"></script>
</head>
<body>
Hallo
</body>
</html>
This appears to be a bug in the Dart Editor that a bunch of people have run into.
We're currently looking into it.
You can follow the bug about this, here: https://code.google.com/p/dart/issues/detail?id=10215

How to get my site using UTF-8 (PHP site)

First time poster and hoping to solve a very frustrating issue.
In Google chrome, my PHP site displays random characters such as Â. However, when I switch the encoding to UTF-8 all the random characters clear up.
I've been reading elsewhere that that I need to tell me site to use UTF-8 by default. My host say this is already enabled on their side.
What code do I add and where to solve this issue?
Put:
<meta http-equiv='content-type' content='text/html; charset=utf-8'/>
In the <head> of the document, and it should force the page to render utf-8 characters properly.
Further description: In your HTML page, you would have the page layed out as such:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<meta http-equiv='content-type' content='text/html; charset=utf-8'/>
<!--<link> tags for any CSS-->
<!--<script> tags for any JS-->
<!--Anything else in the head-->
</head>
<body>
<!--Page contents-->
</body>
</html>

My HTML tags gets tampered with

I have an Umbraco 5 MVC3 project where i discovered that there where white spaces here and there. When investigating i discovered that my HTML looked really bad when "viewing generated source" in firefox web developer tool. For example it removes my doctype declaration and moves my meta-tags and stuff out of the head. Simplified code:
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>#ViewBag.Title</title>
<link rel="stylesheet" href="#Url.Content("~/Content/Styles/style.css")"/>
</head>
<body id="" class="default">
<div id="wrapper">
<header id="banner" class="body">
<a class="ir logo" href="/"><h1>Christian </h1></a>
<ul class="share">
<li id="facebook"><a class="ir" href="http://www.facebook.com/sharer.php?u=#Request.Url.AbsoluteUri">Facebook</a></li>
<li id="twitter"><a class="ir" href="http://twitter.com/share?text=Christian">Twitter</a></li>
</ul>
#Html.Partial("nav")
</header>
<section id="content" class="body">
#RenderBody()
</section>
</div>
<script src="#Url.Content("~/Scripts/plugins.js")"></script>
<script src="#Url.Content("~/Scripts/script.js")"></script>
</body>
</html>
And the output begins like this
<html class="no-js" lang="en"><head></head><body id="" class="default">
If you want to check on the HTML generated by your server, you should use View source (CTRL + U).
Generated source is more like a reconstruction of the HTML based on the DOM and includes for example nodes created on the client side with javascript, once the page is loaded.
Alright, i solved it. Took me a while. After Marapet suggested not to use "generated source" i tried normal "view source" in a bunch of browsers and got different results in all of them. When i tried to validate my source i got some weird complaints:
Non-space characters found without seeing a doctype first. Expected <!DOCTYPE html>.
Element head is missing a required instance of child element title.
And my personal favourite
Cannot recover after last error. Any further errors will be ignored.
Looked like there was something up with the doctype. Opened up notepad and pasted in there to "wash" the code from metadata, the way i do sometimes when pasting stuff in to tinyMCE. The text got formatted weird even in notepad. The doctype declaration had a smaller font size then the rest of the html.
So i opened it in notepad++ too and there i got a bunch of questionmarks in front of the declaration. I removed them and copied it back in to Visual Studio, saved and now everything works.
I think the reason i got this problem was that i copied snippets directly from the HTML5 Boilerplate on github.
// Sherlock

Custom image like button on facebook doesn't work

When I want to share a site on facebook and want to add a custom image it doesn't work. It always gives the same image (one that is somewhere on the web page).
This is the code I've used:
<html>
<head>
<meta property="og:title" content="Title" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://www.the-website.com" />
<meta property="og:image" content="http://url-to-image.com" />
<meta property="og:site_name" content="The content" />
</head>
<body>
<h1> Facebook Like </h1>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.the-website.com%2F&send=false&layout=button_count&width=450&show_faces=true&action=like&colorscheme=light&font&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe>
</body>
</html>
If you try running the page through Facebook linter - http://developers.facebook.com/tools/lint/ - it may show up some issue.
Did you read it ? http://developers.facebook.com/docs/reference/plugins/like/
There is a "code generator" which would do all coding for you. Try it, then copy&paste the code...
As for your code:
- in this case - to have a like on a page - there is no meta needed (your example's meta are not needed).
- you have probably something wrong inside src tag: my guess is to REMOVE the "font&" part, but this might be wrong...
In any case... just use the link I provided...
I had the same problem. What I did was, I just removed the entire line " <meta property="og:image" content="xxxxxxx" /> " . This will push the facebook crawler to scan for every images in the page. Now place the image you want to add somewhere in the page with width=1 and height=1. Users won't recognise this in your page. But this image will be scanned by the crawler and you can select it to show it on our page. This worked for me. I don't know whether it will work for you or not.
NB: This is just a workaround, not a good solution

Resources