Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I am trying to display messages from one user to another on the site. Messages are saved in a database with the HTML.
Why is the HTML on the site, showing up, instead of turning the HTML into a link or a line break?
Here is the code:
<div class="jumbotron">
<h4><u>Your Messages</u></h4>
#foreach (var m in Model.User.MessagesUsers)
{
<p>#m.Message</p>
}
</div>
It looks like you're using ASP.NET MVC. The framework automatically HTML-encodes the output for security reasons.
You can get around that by using #Html.Raw:
<p>#Html.Raw(m.Message)</p>
Be aware however that this is circumventing security. Make sure you trust your data. This is how cross-site scripting attacks happen. You might also want to look into something like Markdown to allow users to enter markup over which you have more control.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
Getting my head banging since this morning to do this simple (I think) thing:
I want to create a link (manually) that automatically selects the third Tab and adds some text to this webpage:
http://www.acessibilidade.gov.pt/accessmonitor/
I've tried some ways, including http://www.acessibilidade.gov.pt/accessmonitor/?#form3 but to no avail... what I am really missing here? Is even possible?
Thanks in advance.
If you dont have access to edit this page's source code then you cannot do what you are suggesting with a simple url or querystring value.
If you could edit the page then you could add some JavaScript or server side code to open the tab you specify in the query string/url.
Fancier solutions include proxying the site and injecting your own javascript or simply re-writing the html but this isn't really recommended as any such solution would be very fragile and the owner of the original site may not be too happy with you doing that.
You could also use a browser automation tool like selenium.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I have create my website and have a domain but when I type the domain name into the browser I get some weird page. I am using 000webhosting and just uploaded the files and they said they were good. I am not sure what is the problem but here is the link
hudsonreamer.com
Hopefully I can get some help
Thanks a lot for the help
Check your DNS/Nameserver records to link files to domain.
Not really covered here however you may want to watch a youtube tutorial on setting up a hosted website.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I am working with the Gmail API and am retrieving the emails as HTML. I want to display the emails on my site but the styling of the emails is getting messed up due to me using the materiazlizecss frame work for other parts of my site.
When I remove the materializecss css file from the page, and just load the emails in a simple div, the styling is left intact, but gets messed up when I add it in. What is the best solution to this? Is there a way to ignore the css file for certain sections of the html?
Can you try using iframe for your mail content?
You could also try using different CSS class for mail content.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
When I click the 'Home' button on my site (beta.tradeacademy.org/dashboard), it shows the links and search box without the css for a split second - as shown in the attached image. Can anyone explain why this happens?
Thanks in advance.
That's called FOUC.
Your CSS files are being fetched much later. Please refer the waterfall.
Try to fetch the CSS in the html head.
The CSS file may not have been loaded prior to the HTML, and therefore not rendered.
Changing the load order would mitigate this issue.
See css loads late, so html looks weird for a second for possible solutions to this.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
So I have a file that's already constantly being update on my server, but the directory currently isn't in my wwwroot folder until I can actually meddle around in there to get the directory to change.
So question #1 is if it's possible for my site to actually access this file away from the wwwroot? If not, it's okay. I'll find some way to get it in there.
This is however the more important part of this question. The file in question is currently in .data extension and contains a field such as {"cpu":30,"ram":300000}. It's been updated in real time with an application in the background, but how would I get my web page to pull those data and display it? I only started learning HTML and CSS several days ago, so my knowledge is still pretty limited here.
I cannot understand your first question. :S Please, could you be more clear?
For the second one, to read the text file you need a javascript code. You can do that as follow:
1º Open the file: file = fopen(getScriptPath("myFile.txt"), 0);
2º Get the content of the file in a string: file_length = flength(file); content = fread(file, file_length);
3º Finally, you can get the part of the string you want by a regex.
Pulling data from external sources and displaying it in HTML is a very common practice the purpose of programming languages like PHP. You aren't going to be able to do it with just HTML/CSS. Stick to static (unchanging) pages until you've got HTML/CSS down, and then you can learn a scripting language to make dynamic pages.