Open office documents in AxWebBrowser control without file download dialog programmatically in vb.net - vb.net

I am trying to open office files in AxWebBrowser control and i did it programmatically in vb.net. But during opening it shows file download dialog with open,save and cancel button so how can i setup it "Open" always instead clicking on it by mouse.

This happening because the Microsoft Web Browser control does not handle Office documents natively. What you have to do is load it in an ActiveX control within the webpage instead.
You could do something like this :
<script language="javascript">
function openDoc() {
var doc = new ActiveXObject("Word.Application");
doc.visible = true;
doc.Documents.Open("path.docx");
}
opeDoc();
</script>

Related

Blazor - Open PDF File in new Tab

I would like to open a pdf document via a button. Is this possible in Blazor?
Thanks for your help
Please try this solution
This is your javascript function
function openFile(data) {
var link = this.document.createElement('a');
link.download = data.fileName;
link.href = data.url;
link.target ="_blank";
this.document.body.appendChild(link);
link.click();
this.document.body.removeChild(link);
}
This is your razor file, replace url with your pdf download url, clicking on button will open pdf in new browser tab
#inject IJSRuntime JS
<button #onclick=#(()=> JS.InvokeVoidAsync("openFile", new {fileName="anyfileName", url="http://anyurl.com"}))>Download PDF</button>
Use HTML?
Download:
<a href=#PdfURL download>Download</a>
or
Open in new tab:
Open
or
Open in current tab (i.e. Navigate to it) :
<a href=#PdfURL>Open</a>?

Magnific popup - how to open it on mouseover?

I'm using Magnific popup our product product pages as a method for image hot points. Right now when you click on a hot point a popup appears with larger image and text. I received a request to open the popup on a mouseover.
Is there a way to trigger open Magnific Popup on a mouseover not on a mouse click?
I was trying to call the mouseover event on the link first, but it seems the Popup still requires a click. How to I make it so it opens up just with a mouseover?
<!-- Popup link -->
Show inline popup
<!-- Popup itself -->
<div id="test-popup" class="white-popup mfp-hide">
Popup content
</div>
Javascript:
$('.open-popup-link').mouseover(function(){
$(this).magnificPopup({
type: 'inline'
});
});
Answering my own question. After a bit more research I found that I needed to open the popup directly via API. It works now:
$('.open-popup-link').mouseover(function(){
$.magnificPopup.open({
items: {
src: '.white-popup' // can be a HTML string, jQuery object, or CSS selector
}
})
});
Working example: https://codepen.io/pen/ZKrVNK
Taking it further with multiple links opening separate slides of a gallery, using event delegation:
http://codepen.io/pen/EmEOMa

AutoCAD Lisp hook up help function to show Youtube video

I'm having trouble hooking up the F1 help function in AutoCAD Lisp with a custom Youtube video instead of showing the default AutoCAD Help files. I've found this article to be quite helpful, but it won't allow me to supply a youtube video in any way.
The custom AutoCAD browser is too old and does not support HTML5 (which is needed to run Youtube videos). Any help on how to solve my issue?
Case: How to bind the F1 help to a custom function in AutoCAD Lisp, then activate a Youtube clip on F1 keypress.
After a while, I got it all figured out. I had to use a combination of HTML/Javascript to trigger the default web browser (which hopefully supports HTML5), and then view the Youtube clip there:
Lisp:
(setfunhelp "C:MyFunction" "C:\\path\\to\\html\\file\\MyFunc_Help.html")
(defun C:MyFunction ()
(alert "this is my function")
)
HTML:
<html>
<body>
<script>
function OpenInNewTab(url, callback) {
var acWindow = window.open("", "_self");
acWindow.document.write("");
setTimeout (function() {acWindow.close();},500);
var newWindow = window.open(url, '_blank');
newWindow.focus();
}
OpenInNewTab("https://youtu.be/FERNTAh5s0I");
</script>
</body>
</html>
This HTML code opens a new browser window in your default browser, then closes the AutoCAD default browser after 500 milliseconds.
I hope this will be of help to someone.

I want to open a PDF file within the application in titanium studio

I have URL of PDF file and want to open within the application so that i can navigate back to application. I don't want to go to browser. Can anyone help?
Check this out:
iOS:
http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.UI.iOS.DocumentViewer
Android
http://developer.appcelerator.com/question/72361/open-pdf-file-on-android
Or you could try and show it in a webview:
var pdfViewer = Ti.UI.createWebView({
url: "url.pdf",
width:1000,
height:1000
});

open url in default OS browser

Is there a way to open URL in default OS browser?
I have MenuItem and want to open certain URL whenever user clicks this item:
var item = new gui.MenuItem({
label: 'Shortcut',
click: function(){
//here i want OS to open some URL
}
});
You can proceed like that:
gui.Shell.openExternal("http://website.com")
See the documentation here: https://github.com/rogerwang/node-webkit/wiki/Shell
See also How to open a browser window from a node-webkit app? for more informations.