Open a Word File from Javascript Similar to Clicking a Hyperlink - javascript

I have a hyperlink in my web page that opens a Word document however before the document is open I need to perform some other tasks. I substituted the hyperlink for a button and this successfully runs my code but how can I then open the Word document in a browser agnostic fashion, i.e. similar to the anchor element;
Produce Report
I have tried several searches for this problem but most of the responses suggest using something like "window.location" top open the file but I don't want to load the file in the browser.
Any suggestions would be greatly appreciated.

Related

is there any idea to download a pdf from sublinks?

i have a website http://studies.hum.da.gb contains many links like this one:
http://studies.hum.da.gb/mod/resource/view.php?id=7562
when i click one of them it open a pdf document like this one
http://studies.hum.da.gb/pluginfile.php/97808/mod_resource/content/1/anatomyLv.pdf
my question is How do i get all the documents without click every link ?
i tried to:
1-navigate http://studies.hum.da.gb/pluginfile.php/97808/mod_resource/content/1/
no susccess
2-i tried web grabber like httrack but not worked
i am using linux as my OS
maybe i can simulate a mouse click on every link and download the resulting pdf without open it on another tab but i have no javascript experience

source code of a website that is blocked access to right click and Source code

I wanna see the source code of this website but I can't right click or anything! can someone help me with it?
website link: https://vcard2.themefix.ir/full-rtl/about.html
While a page can intercept and block clicks and keystrokes on the page itself, it can't do the same for actions outside the page. Focus on something outside the page (such as the address bar) and use a keyboard shortcut that opens the source - Control-U, in many browsers.
But the source text of that site is also hard to get to, because there are many empty lines. Use a text processor or some other tool to replace multiple occurrences of \r\n with a single \r\n, and you'll be left with the readable source code in front of you.

How to open a file directly from msSaveOrOpenBlob?

I am using IE 11 for web development. Now in javascript, I do window.msSaveOrOpenBlob(fileBlob), a pop up shows on the button of the page with save and open option.
Now what I want to achieve is that perform click event on open so the file will be open automatically(without user click open).
Here is the case:
User click a link, it should open the associated file with whatever file reader that can open the file. PDF, will be adobe reader, word document will be opened in microsoft word.
Things still works when I click the open button from pop up. I just want to skip this manual click and do it in the code.
I've seen some webpage does this, but can't figure out myself. Need some help.
As far as I know, we can't control the "open or save" prompt using JavaScript. It is the browser behavior.
As a workaround, to the pdf file, I suggest you could try to use the pdf.js plugin to display the pdf file. To the Office documents, you could check the following article to use the Office Web Viewer to view the document.
Office Web Viewer: View Office documents in a browser
Besides, here is an article about displaying (Show) Word, Excel, PowerPoint (PPT) and PDF files in browser web page in ASP.Net, you can also refer to it.

Python programatically opening a link by clicking?

I am trying to parse a whole website
Target Link: http://targetsite.com
which has lots of child links and I want to parse all its child links.
Links within the Target Page:-
http://targetsite.com/childpage/1
http://targetsite.com/childpage/2
http://targetsite.com/childpage/3
The problem I am having is that if I am directly opening these links for example -
http://targetsite.com/childpage/1
using either Curl or Python urllib2 or Python Selenium.
Then the website is redirecting me to CAPTCHA Page first to Prevent Automated Malicious Programs from parsing that page.
But if I open that link by click it in then its Opens without redirecting to CAPTCHA page.
Opening http://targetsite.com/childpage/1
By clicking this link from http://targetsite.com main page.
And then it displays that page.
I want to know how the website is tracking whether a link has been
opened directly or by click action.
Suggest a suitable way to do this kind of Web Scraping automatically in Python
NOTE:-
I have also tried it by just copy pasting that link to browser and opening it directly without using click action in that case too its redirecting to CAPTCHA Page.

Printing a Word document from IE without opening print dialog

I have a requirement where I need to print a specific word document when I click on a button in IE8/IE9. I tried to find a way using ExecWB and other methods but could not achieve my goal. Couple of constraints I have are as follows.
The word document is availble through URL and this URL is from a different site than the page where I am clicking the button to print (XSS considerations ?)
I need to directly print using default printer without popping up the print dialog.
Is this possible in anyway?
Impossible from within the context of HTML page, without a custom browser extension. Word document must open before it's printed (maybe not visually presented to the user upon opening, but MS Word or some other application that is capable of opening word docs must be installed on the client system. There is Office extension for IE, which can be used to open the document, but the user has to click on the print button to invoke the dialog. There's nothing that you can do from within javascript to accomplish that. I'm sure you could, if you wrote your own IE extension/plugin, but unless your users are corporate that must install it, nobody else will.
I hope I'm not lying to you.

Categories