I'm making a Web-view moblie application with java and javascript
What I want to do is
when people click the download link, i want to check whether they have my application or not, so
if they have, i want to open the application and if not, open the playstore to download.
I dont know if it's possible but basically I have this problem:
I have a website that I regularly visit and it has a tons of sub-urls.
I wrote myself another script / site which I'm using on XAMMP / localhost to analyze things (based on the website).
Now whenever I visit said website, I want there to be button (on each site) that links a href to my localhost. So whenever I have XAMMP running, I could simply click to create a new tab from the website to my localhost site.
This as opposed to having to manually open my corresponding localhost site.
Is something like this possible ?
If not, would there be another feasible solution to "sort of" alter the website so I can use it better in conjunction with my custom scripts ?
You might want to see chrome/Firefox extension Greasemonkey or Tampermonkey which allows running userscripts.
I am building a messaging web application where I want to add a functionality to capture and upload the screenshot of any of the opened windows selected by the user.
Complete Use case: On the web app instead of uploading an image user will click a button (called capture) which will enable the user to take a screen capture of any of the selected window. This is similar to screenshot/screen clipping in outlook or office products. We need this functionality to be embedded in the web app running on the browser.
Example: A user is using my web app and wants to share a painting art s/he made using the paint application, s/he clicks on the 'capture' button and select the paint window which is opened and take a screenshot of that paint window and upload that image in the web app.
Is there any javascript library which can help me perform this action?
It is different from this question (Using HTML5/Canvas/JavaScript to take in-browser screenshots) as I am looking for the screenshot on different window rather than on the browser window.
Thank you.
It is not possible to capture screenshot, or do anything at all, outside of the DOM content in one tab/window.
Refer https://en.wikipedia.org/wiki/Same-origin_policy
A web page can only access its own contents. Not other web pages. Not things outside the window.
If you're looking for some tool to capture screenshots of any window and any web page, it should be a native application of that OS (windows app, android app, etc) and should use the tools/api's provided by that OS. That cannot be integrated directly into a web page.
The closest option is to let the user take a screenshot using whatever tool necessary and upload/paste that image onto your web page.
I have a website www.website.com. A web user opens website.come/article.html where there is html text, images.... and javascript content (wich is different for every user).
Now my website is wordpress powered, how can i download the final version (javascript loaded and executed) of the pages opened by my users?
I want to do that because i want to know what content javascript displays for each one of them.
Can i use a php/javascript function or is there any service which do that?
You'll need a headless browser like PhantomJS to visit the page, let the javascript run and then extract the content.
There is a PHP bridge available at https://github.com/diggin/php-PhantomjsRunner, but I don't know whether it's any good.
If you call javascript window.open and pass a url to a .xls file it open on some machines in the browser window. How can you force it into Excel?
Only the users machine can "force" it into Excel. That said, 99% of the time if you send the correct mime-type and a user has Excel, then it will open in Excel assuming they approve.
And only the server can send the correct mime-type. The document type you pass to a JavaScript window.open call will have no effect on this. In fact, calling window.open will at best just open a superfluous window.
It's best to just link to the document with <a href="foo.xls">. And provided your server is sending a mime-type of application/x-excel or application/x-msexcel this will almost always nudge the browser into opening a new window with the Excel document.
If it's just a static file, and you're using Apache on Linux, check for a file called /etc/mime.types, and ensure that it has the following line in there to associate the .xls file extension with the correct MIME type:
application/vnd.ms-excel xls
I'm guessing the location of that file might vary across systems, but it's in /etc/mime.types on my server which is running RHEL4.
AFAIK you can't do this with JavaScript alone. If you have some sort of scripting language on the server's side you can alter the header to force a download.
Here's a simple tutorial in PHP, but you can easily find one in your favorite language.
You cannot force it into Excel. You can allow the browser to handle it whichever way it is configured to do so, or you can try to force it to download the file and let the user open if from their desktop. To force a download, search for "force download" and your server-side language (PHP, ASP.NET, JSP, etc.)
I don't think you can: you cannot call external programs using Javascript for security reasons. Assuming that the user has Excel installed, you may want to open the new window without the address bar to give the user "the illusion" that the file has been opened with Excel in Internet Explorer.
I wouldn't think this is possible from javascript due to security issues, there would be nothing stopping a rogue webpage from opening dozens of excel/word instances.
Could you not set a hyperlink to the url of the .xls, that way the user would get the usual download prompt to view the file.
Set the http content type to the Excel datatype: application/vnd.ms-excel
You shouldn't need to redirect to a new window, but you will get a popup asking the user to save or open the file.
In relation to (2): I'd worry if a browser could launch an external application and load data into it automatically without user intervention.
This is a setting in each user's browser and not in something that can be set by code. So unfortunately you do not have control of that.
You can not, as it depends on the client machine.
For example on Windows if you want it to always open it with Excel, not in the browser window, you have to open My Computer, Tools, Folder Options, File Types, select the XLS type, and click on Advanced. There are two checkboxes: Browse in same window and Open web documents in place. Uncheck both, close browser window, open it again and try again.
However as I said: it depends on the client, you can not force it.
You can do this using LaunchinIE, an ActiveX Control that will enable HTML pages to start whatever application on the client's machine, without security warnings.
Quote from the site: "At last, web pages can start Word, Excel, or any other corporate application without complaints. Securely."
For this you do have to install the control on the user machine and also add the URL that is allowed to execute local applications to the Windows registry.
Another quote from the site: "To ensure security, LaunchinIE needs to be carefully configured client-side; due to this restriction it's only fit for intranet use."
I use LaunchinIE in our training facility so I can use Internet Explorer as a menu which lets the user choose the machine setup. LaunchinIE then calls a batch script that configures the machine to best support the selected training.
Here are the steps to get this pop-up back when opening a saved Excel file.
Right-Click on the windows [START] button and select Explore to open Windows Explorer window will open.
From the menu select Tools \ Folder Options…
• Choose the File Types tab and scroll down the list of files.
• Left-Click to highlight the XLS Microsoft Excel Worksheet file extension and click on the Advanced button.
In the Edit File Type window, Uncheck the “Browse in same window” option.
Click OK button to accept your changes.
Start a new browser session. The next time you open your Excel spreadsheet in your Inbox, you should be prompted with the following window. Be sure to leave the “Always ask before opening this type of file” as checked. Clicking the Open button should now open your file in Excel.