I have requirement to load one JSP/HTML5 page in UIWebView. In this page there is link for attachment and on click of that I need to open CameraRoll to select file and then upload it to server. This is same like we do attachment in email. Now problem is from Java Script how do I open CameraRoll? My main query is that is it possible to open CameraRoll from Java Script without calling Native iOS methods. Java Script to open dialog is embedded in JSP/HTML5 page.
Let me know if you find that above information is not enough so I will try to give you more detail. Ultimately I have one page in UIWebView which should work like sending some message to user with attachment from CameraRoll like we do in normal email app.
I searched a lot on net but couldnt find any help on this.
Starting in iOS6, you can access the Media Capture API which allows you to request files from the user via <input type="file" />.
Essentially, all you need to do is include an <input type="file" /> and when the user touches the input, it will open the phone's camera roll.
Once the user has selected the file, you can send the file using the POST form action or AJAX, or use the File API to manipulate the file data on the client side. Check out the HTML Media Capture specification from the W3C for more information on implemention.
Related
I am AJAX call and when the server (REST service) sends the response it is actually a link to the generated file something like
/project/tmporaryFiles/file.abc
(File extension is also customized) It is just a text file. when I use $window.open then it just opens the text file in the browser and displays the text. I would like to open a saveas dialog box so that user user should be able to save the file instead of viewing it in the browser. I have tried multiple threads of stackoverflow but could not found solution. Most of the solutions are for HTML5 i.e. the download attribute in anchor, I believe this is not available in HTML4x.
One solution I am trying to find is to create a Blob with the response link but that I am unable to do.
Also note the file can be more than 100MB as well based on the data processing and input by the user.
I you want to force the download without using HTML5 download attribute, you will need to set Content-Disposition on response header.
This can be done on server side and not client.
In outlook, there is a feature “Home page address” of folder through which we can view web site within the outlook. If we set http://app.abctest.com in the Home page address of a folder, then when we click this folder in the outlook, it will display that page.
I have a very specific requirement for enabling end user to browse a web site (in my case, it basically lists some archived emails) within from the Outlook. This can be easily done by setting the “Home page address” in the properties windows of any Folder of Outlook.
The user will see the page within outlook. He can search the old archived emails in the page. Then, the users should be able to download that email and save it to a folder in outlook. End users are basically searching the emails within outlook and downloading them from the server directly to their outlook folder. When user click the download\save link or button, then the outlook’s “Select Folder” dialog should appear where user can select the destination folder. When user click “OK” button, that email should be save to the selected folder in the outlook.
Currently, I have very few solutions but not sure if they can achieve the goal.
Solution 1: ActiveXObject
I tried to use Outlook ActiveXObject in javascript (used the following code in my test page) but I got the following Script error Popup message.
“Automation server cannot create the object”.
Javascript code:
var objO = new ActiveXObject('Outlook.Application');
Solution 2: Javascript API for Office
I have started to read the MSDN documentation https://msdn.microsoft.com/en-us/library/office/fp142185.aspx but have not got any sample code.
Could someone please sheds some light on it? Or what would be the best solution for this? Or any alternative solution.
Prakash,
Only one instance of Outlook can be run at the same time. Try to use the GetObject function instead to get the running Outlook instance instead. See How to programmatically create an Outlook home folder page in the Outlook Today style for more information. However, home page scripting is limited and secured to prevent malicious software. I'd suggest developing an add-in which can add a custom form instead.
The second solution listed above is for Mail Apps. See How to: Create your first mail app for Outlook by using Visual Studio for more information.
When your script runs inside a folder home page, window.external.OutlookApplication will point to an instance off the Outlook.Application object - your should be able to use it without creating a new object.
I've managed to get the element of a button inside a a webpage . I know its ID , its class , etc ; I even managed to trigger the click event from within a content script from a Google Chrome extension . The button is inside a Google webpage.
There's a Browse button though that opens up a openDialog window and prompts the user to chose a certain file for uploading. How can I go on automating this upload without prompting the user for the file? I just want to feed it the string from the content script and the webpage takes it from there.
Is there a solution for this in Google Chrome, Firefox?
Thank you!
if you are uploading from the clients computer, you can't. Its a security feature of file.upload. If you examine the path to the uploaded file, you'll notice c://fakepath/xxxxx this is to prevent applications finding out file structure on the clients computer.
https://developer.mozilla.org/en-US/docs/Using_files_from_web_applications
In Firefox add-ons (well, in the privileged parts, i.e. not SDK page-mods and so on), you can construct a file object you could use with the regular HTML5 stuff (XMLHttpRequest, FormData ;)) directly via the File "constructor":
var file = File("path/to/some/file");
When it comes to Chrome you're out of luck as #David already correctly pointed out in the other answer.
Edit 1:
Actually, when it comes to chrome it might be possible to request a file://* permission, have the user opt-in explicitly, and then use xhr etc. to first retrieve the file as a blob and then upload the blob with another xhr. Haven't tested this, though.
I have a Django web application in which I want to give an option to capture the image in the registration form. So, whenever the user presses the capture image button then the camera on the client system should open to take the image, the image then would get stored in the server-side folder.
I am thinking that the camera should open from the HTML page and send the image to the server, but I am not able to open the camera using the HTML code.
Please advise me.
You can use WebRTC for this; html5rocks.com has a nice tutorial, see especially the example of taking screenshots. To store the image on the server, you'll have to upload it via AJAX.
You have several options to access client webcam. The easiest way is HTML5. But you can use
sveral tools in silverlight and flash plugin.
See how-to-access-webcam-from-html5 and html5-getusermedia-record-webcam-both-audio-and-video
After getting image in page you can send it to server in diffrent ways including JavaScript (with AJAX) or using HTML form element (like file input)
I was wondering if there was a way to prevent a user from saving/downloading a web page? Specifically, I mean not letting them have access to the data displayed through my web application on their own machine?
I've heard that this is not possible since the browser must have access to the source code/data, but at the same time, I've noticed that if I to my gmail account, open an email, save the page, but when I try to open that page on my computer, it doesn't work. Furthermore, if I click "view source", I can see that even the source does not display the entire email message, even though the email is opened in my browser.
How it's possible for gmail to prevent me from seeing that email data?
Thats what called rendering pages using dynamic data without refreshing page (AJAX). The entire page source code is not downloaded in one go and components within the page request data asynchronously to display content. Try googling it and you will find more information.
In View source you can only see the HTML, CSS, JavaScript codes. No one can copy any dynamic code (PHP) from view source.
You can't stop anyone to see your html,css code in browser, as we are having view source option.
Maximum what you can do is disable right click on your page. Thant can be done through JavaScript.