I have an HTML file that I am tinkering with attempting create a web form with functionality and have a PDF view embeded.
<!DOCTYPE html>
<html><head></head>
<body>
<object data="C:\test\PI.pdf" type="application/pdf" width="300" height="200"></object>
</body>
</html>
The PDF works fine when I open it from windows explorer or sublime text. It will have a URL in the browser that looks like this:
file:///C:/Users/dvandenbosch/Desktop/Visual%20Studio%20And%20General%20Programming/temp/scratchpad.html
When I open it from visual studio, it doesn't allow me to see the pdf. It is just blank. It has a URL that looks like this.
http://localhost:59478/scratchpad.html
Why is this?
I need to be able to show pdfs from my shared file drive on to our internal sharepoint using a web browser. Please help!
Related
I am using the C# WebBrowser control. My HTML renders fine. However, I need to keep external files on the local computer. References to the local copy of files do not work.
How do I write the HTML to load locally stored files?
This works:
<script type='text/javascript' src='https://code.jquery.com/jquery-latest.min.js'></script>
This works when loading a file directly in to a browser, but not through the C# WebBrowser control:
<script type='text/javascript' src='./jquery-latest.min.js'></script>
Adding the full path gets rid of error messages, but still does not work.
<script type='text/javascript' src='file:///C:/<full path>/jquery-latest.min.js'></script>
I have tried adding this to the first line of the html file which does not solve the problem.
<!-- saved from url=(0014)about:internet -->
Just put your local js file in the same directory with your html file. Then use this will do
<script type='text/javascript' src='./jquery-latest.min.js'></script>
I have an HTML file, and I want to know how to know how to embed the file in a C# windows form application in Visual Studio 2019 (community edition). All I need is the html file to show up in the same window the Windows Forms app is located in.
This code is from more than a decade ago, but it works.
First:
Create your HTML file
Add it to your project
Set the properties for the file to
Build Action: EmbeddedResource
Copy to Output Directory: Do Not Copy
That will put your HTML file contents in your assembly as an embedded resource.
Then use code like this (in my case the html file is HelpText.htm):
Assembly thisAssembly=Assembly.GetExecutingAssembly();
string appName=thisAssembly.GetName().Name;
helpTextStream=thisAssembly.GetManifestResourceStream(appName+".HelpText.htm");
webBrowser1.DocumentStream=helpTextStream;
The webBrowser1 property is a WebBrowser control on a Windows Forms form.
You should also include code to Dispose the helpTextStream when you close the form.
I am a newbie in asp.net. I m trying to add a logo in my _layout.cshtml file but it's not getting into view. It's showing a broken image. The image is in Assets folder. Don't know what I am doing wrong. Any help would be appreciated.
Here's the screenshot of my code and structure.
For static files in asp.net core, you need to place them in wwwroot folder in your project by default.
Follow steps below:
Move Assets folder to wwwroot
Change the html code like:
<img src="~/Assets/logo.png" />
I am trying to download file on a link click following this stackoverflow question Angularjs simple file download. After i click the link file downloads with error saying Failed No file. I have checked projects App_Data folder file is present there. Can anyone help figure out the issue.
<a target="_self" download="{{q.FileName}}" ng-href="{{q.QuizFile}}" href="#">Open File</a>
It renders into this path...
<a target="_self" download="Discussion.docx" ng-href="~/App_Data/74edf10b-5c18-472f-92bb-c64f55575b29/Discussion.docx" href="~/App_Data/74edf10b-5c18-472f-92bb-c64f55575b29/Discussion.docx">Open File</a>
The tilde in the path name doesn't mean anything in JavaScript. Its a convenience in mvc that resolves server side. Pass the path without the tilde.
I have created a plugin. In that I have taken a folder and that folder contains an HTML page, manifest file, image and a .js file. Then I am loading the extension from load unpacked extensions from the Google Chrome extensions settings. Then the plugin is added to Chrome.
I have then packed the extension and I have gotten a .crx file and .pem file. I have dragged that file in to the Chrome folder and it is also adding it to Chrome.
I am including that file in a download link on my website like:
Download
And added the mime file type extension in the web.config file like:
<system.webServer>
<staticContent>
<mimeMap fileExtension=".crx" mimeType="application/x-chrome-extension" />
</staticContent>
</system.webServer>
Now the file is downloading on link button click and it is getting an error:
Apps,extensions and user scripts cannot be added from this website.
My website is not live yet, I am using only localhost. How can I rectify this?
Any help is appreciated.
You can not trigger installation through <a href="#Url.Content("../test.crx")"
You should have a link tag <link rel="chrome-webstore-item"
href="https://chrome.google.com/webstore/detail/apdfllckaahabafndbhieahigkjlhalf">
You can trigger installation through chrome.webstore.install(url, successCallback, failureCallback)
For more information check documentation.