JavaScript - Open Local File??
Hi all. I have text area that includes the full path for a local file on our company network. The files are usually excel sheets or docs. How can I have it so when they clicks the file it opens the local file?
Similar TutorialsHi there, Can anybody help me to write php/javascript code which will allow users to open files directly from web browser into desktop application? Here is the specification: I have a photo editing business with many people working in Photoshop. I am currently developing a web based application (joblist) using Javascript and PHP which should allow the photoshop designers to browse and open files/images directly from joblist/web browser into photoshop. The reason I want this instead of browsing folder is that I have a database where I store who worked on which file, when and how long it took. The concept is that, designers will select a file and click on start, as soon as they click on start the original file will open in Photoshop and there will be an entry into database (using PHP). Once they finish the task they will close the file and click on Finish button. My joblist application will be published in a local server and the file will be open on a local network, so when they save the file it will be saved where the source file is located in (local server). The application should work in both PC and Mac. I have already done all other part of the application except file opening directly from browser to desktop application functionality. Anybody can help me to write the code (PHP or Javascript) which can open the file from browser (local server) directly into desktop application e.g. PHotoshop or Illustrator? Thank you very much I look forward to someone's real help! Best regards Mr. Sumon Hi there, I have a photo editing business with many people working in Photoshop. I am currently developing a web based application (joblist) using Javascript and PHP which should allow the photoshop designers to browse and open files/images directly from joblist/web browser into photoshop. The reason I want this instead of browsing folder is that I have a database where I store who worked on which file, when and how long it took. The concept is that, designers will select a file and click on start, as soon as they click on start the original file will open in Photoshop and there will be an entry into database (using PHP). Once they finish the task they will close the file and click on Finish button. My joblist application will be published in a local server and the file will be open on a local network, so when they save the file it will be saved where the source file is located in (local server). The application should work in both PC and Mac. Anybody can help me to write the code (PHP or Javascript) which can open the file from browser (local server) directly into desktop application e.g. PHotoshop or Illustrator? Thank you very much I look forward to someone's real help! Best regards Mr. Sumon www.clippingpathindia.com Hello to all ... I am very basic on this of javascript, so someone could help me how to resolve this issue. I have a javascript (HTML internal), which fetches and executes a file in another web address... but I do not want it to do that, i want this script to execute is function directly from my local disk (file location). Here is the script; Code: <html> <head></head> <body> <div style="WIDTH: 984px; HEIGHT: 443px" > <script type="text/javascript"> var previewConfigs = [{ type: 'flash', preview_url: "http://myflashtest.com/files/9083/preview.swf", base: "http://myflashtest/files/9083/" }]; </script> <span id="large_item_preview"> <object style="visibility: visible; Z-INDEX: 0; WIDTH: 590px; HEIGHT: 300px; TOP: -51px; LEFT: -27px; " id="large_item_preview_container" data="srcs-ff/preview.swf"></object> </span> <script type="text/javascript" src="srcs-ff/jquery.js"> </script> <script type="text/javascript" src="srcs-ff/preview.js"> </script> <script type="text/javascript"> if (typeof(previewConfigs) !== 'undefined') { for (var i = 0; i < previewConfigs.length; i += 1) { var preview = new ItemPreview(previewConfigs[i]); preview.display(); }; }; </script> <script type="text/javascript"> $(document).ready(function() { $("tr[data-accessor=source]").click(); }); </script> </div> </body> </html> <b>What I want is to change this part;</b>; preview_url: "http://myflashtest.com/files/9083/preview.swf", base: "http://myflashtest/files/9083/" hi my website is in php . am using a javascript code to open a file . Code: function dec() { window.open("www.test.com/files/2010/test.pdf"); } when i click the hyperlink connected to this function , a browser window is opened .path to the file will be dispaled in the address bar i dont want it like tat. i need to open only the file test.pdf , not in browser window so that path will not be seen . pls help. Hi, I am trying to open a FTP file in IE 6, but Its not opening, it throws "Page cannot be Displayed" message. Its work fine in Firefox. Below is the code: <A href="ftp://sysvine.lmt.com/reports/chart.doc">Category Chart</A> even I tried like this: <A href="ftp://username:password@sysvine.lmt.com/reports/chart.doc">Category Chart</A> Please let me know if there is any workaround. Regards, Selvin hi my website is in php . am using a javascript code to open a file . Code: function dec() { window.open("www.test.com/files/2010/test.pdf"); } when i click the hyperlink connected to this function , a browser window is opened .path to the file will be dispaled in the address bar i dont want it like tat. i need to open only the file test.pdf , not in browser window so that path will not be seen . pls help. I've been watching an application called JSPDF http://code.google.com/p/jspdf/ that creates a PDF file solely in client side javascript. In a nutshell, it generates pdf bytes (called buffer), encodes the bytes into base64, and opens it in the browser: Code: document.location.href = 'data:application/pdf;base64,' + Base64.encode(buffer); This works for me in firefox and chrome, but not IE. My question: is there a better way to reform the file download/opening in javascript? They provide an example with downloadify and that may be acceptable unless you are trying to eliminate flash from the equation. Thanks Hi guys i have an embedded game in an html (unity3D) and i am wanting to delete a file from my server. so at the moment i have a php file on my server and the html containing the javascript on my desktop. test.php PHP Code: <?php $conn = ftp_connect("ftp.domain.co.uk") or die("Could not connect"); ftp_login($conn,"username","password"); echo ftp_delete($conn,"test.txt"); ftp_close($conn); ?> I will out the correct domian name and username and password and this should delete a file named test.txt on my server. the problem i am having is calling this script from my javascript which is my main html: i have searched all over and found if i do this : Code: <script language="JavaScript"> function DELETE_SERVER_FILE() { dummyimage = new Image(); dummyimage.src ="http://www.domain.co.uk/test.php" } </script> But this is not working, can anyone help? How do I open a window from within a .js file? I want to do this, below in a .js file like I would in a html file. <a href="google.co.uk" class="thickbox"></a> Hi, I am kinda new to java scripting and here is what i am trying to do. I have a folder "A" with 10 files, all with .txt extensions in it. I want a java script to open all the 10 files in the folder "A" and change the extensions to .js and save it in a folder "B". Can some one help. Thanks a lot in advance. Hi guys, I have been working on this and cant figure it out. I have an index.html as my main file and I wanted to have a pop-up window that will also open together with the index file. the pop-up window is a notepad like type, file name is clipboard.html. Addon: i started adding code to have the pop-up to stay on the right side of the screen and always on top. As of right now, all codes are very confusing and i decided to delete and start from scratch. Can you guys fill in the blanks? Hi: The code below, partly suggested by Old Pedant, will open the radio button PDF file, but it will take up the entire screen. Is it possible to open the checked PDF file in a slightly smaller screen so that the user, when finished with the PDF file, can always be sure that he/she is closing only the PDF file and not the browser? I'm trying to use the showDetails() to do this, but am having two problems: 1) where in the <body> should this function be "called", and 2) how does one get a file name into the first parameter of window.open when the name of the file is not known until the user has checked one of the several choices? Or is it the Foxit and Adobe Readers that govern the screen size of the PDF files, and not Javascript? Thanks for any help and pointing me in the right direction. <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Open smaller PDF window.html</title> <script type="text/javascript"> function goToCheckedValue ( rbs ) //courtesy of Old Pedant { var go = null; if (rbs.length == null ) { if (rbs.checked ) go = rbs.value; } else { for (var r = 0; r < rbs.length; ++r ) { if (rbs[r].checked ) go = rbs [r].value; } } if ( go == null ) return; location.href = go; } var detailsWindow; function showDetails() { //leave filename parameter blank detailsWindow = window.open("","", "width=500,height=350"); detailsWindow.focus(); } </script> </head> <body> <form name="myForm"> <fieldset id="pdfchoices"> <input type="radio" name="gmplitword" value="11.pdf" checked="checked" /> Gospel Acclamation <br /> <input type="radio" name="gmplitword" value="15.pdf" /> Gospel Acclamation - Lent <br /> <input type="radio" name="gmplitword" value="16.pdf" /> Gospel Acclamation - Paschal time <br /> <input type="radio" name="gmplitword" value="23.pdf" /> Apostles' Creed (IV) <br /> <br /> <input type="button" value="Open PDF file" onclick="goToCheckedValue(this.form.gmplitword)" /> </fieldset> </form> </body> </html> Hello I'd like to open using JS an outlook send mail window having a file from the server (full url, that should work, right ?) attached. Is this possible ? If so, please tell me how. Thanks Hi, I want to restrict opening my popup window if it is already opened. For simple scenario, it is quite possible to do but in my case -- 1) When parent page is opening popup window, it is getting refreshed (required from client for some reason). 2) Once submit button is clicked from popup window, again parent page is getting refreshed (again its a requirement from client side). With these 2 conditions, I lost my saved value from variable and hence new popup is keep coming when the action is same. Currently I am using below code to open popup [CODE] function OpenWindow() { if(winPop && !winPop.closed) { alert("Popup is already open"); } else { winPop = window.open('MyPopupPage.aspx'); } } [CODE] Please help me to get rid of this problem. Thanks in advance. - Bhasker I'm having major pains trying to figure this out. I'm kind of new to Javascript, I need to open a text file from an external server, store each line in an array, then search that array for a certain word (HIGH), and if it exists then write something to the webpage, and if not, write something else. Here is what I have so far: Code: <html> <head> <title>Test</title> <script> <!-- function test(x) { if (wxd1txt.readyState === 4 && wxd1txt.status === 200) { // Makes sure the document is ready to parse and Makes sure it's found the file. var wxd1text = wxd1txt.responseText; var wxd1array = wxd1txt.responseText.split("\n"); // Will separate each line into an array var wxd1high = wxd1array.toString(); //Converting the String content to String //var highsearchreg = new RegExp("HIGH"); //var wxd1high = wxd1array[x].search(highsearchreg); document.write(wxd1high); if (wxd1high.search("HIGH") >= 0){ document.write("HIGH RISK");} else { document.write("NO RISK");} } } //--> </script> </head> <body> Hi! <script> <!-- var Today = new Date(); var ThisDay = Today.getDate(); var ThisMonth = Today.getMonth()+1; var ThisYear = Today.getYear(); var Hour = Today.getHours(); var Day2 = Today.getDate()+1; var Day3 = Today.getDate()+2; if (navigator.appName != "Microsoft Internet Explorer") { ThisYear = ThisYear + 1900;} if (ThisMonth < 10) { ThisMonth = "0" + ThisMonth;} if (ThisDay < 10) { ThisDay = "0" + ThisDay;} if (Hour == 2 || Hour == 22 || Hour == 23 || Hour == 0 || Hour == 1) { var wxHourd1 = 0600} else if (Hour >= 3 && Hour <= 10) { var wxHourd1 = 1300;} else if (Hour >= 11 && Hour <= 13) { var wxHourd1 = 1630;} else if (Hour >= 14 && Hour <= 16) { var wxHourd1 = 2000;} else if (Hour >= 17 && Hour <= 21) { var wxHourd1 = 0100;} //var wxurld1 = "http://www.spc.noaa.gov/products/outlook/archive/"+ThisYear+"/KWNSPTSDY1_"+ThisYear+""+ThisMonth+""+ThisDay+""+wxHourd1+".txt"; var wxurld1 = "http://www.spc.noaa.gov/products/outlook/archive/2010/KWNSPTSDY1_201005101300.txt" //(High risk day for testing) //document.write(wxurld1); //Use this to verify this section is working if (window.XMLHttpRequest) { wxd1txt=new XMLHttpRequest(); } else // IE 5/6 { wxd1txt=new ActiveXObject("Microsoft.XMLHTTP"); } wxd1txt.open("GET", wxurld1, true); wxd1txt.onreadystatechange = test(); // --> </script> </body> </html> When added to a webpage, nothing shows up except the "Hi!" and there are no errors in the Javascript Console in Google Chrome. Is this possible with Javascript, and if so, what am I doing wrong or not doing? Also, I have 2 URLs, one is a text file that has the HIGH text I want for an example, the other is the current file, which shouldn't have HIGH in it (unless the weather in the US turns really bad) I do write some php, but have not much idea about JavaScript. I use window.open to open 10 pages simultaneously. I prefer to open them with a time delay from each other to put less load on the target server. This is my code with no delay. (I played around with setTimeout but can't get it to work.) PHP Code: <a href='http://www.".$new[9]."' onclick="window.open('http://www.".$new[0]."/'); window.open('http://www.".$new[1]."/'); window.open('http://www.".$new[2]."/'); window.open('http://www.".$new[3]."/'); window.open('http://www.".$new[4]."/'); window.open('http://www.".$new[5]."/'); window.open('http://www.".$new[6]."/'); window.open('http://www.".$new[7]."/'); window.open('http://www.".$new[8]."/')\" target='new300/'>Open 10</a> Hello, Wondering if any users could point me in the right direction on this one. Newbie question, how do I call up a local Var within a function? As you can see I have both a global and a local. but the doc.write will only show the global var. Code: <html> <head> <script type="text/javascript"> var p=0; function test(){ p=p+5; window.alert(p); } </script> </head> <body> <h1>test: <script type="text/javascript"> document.write(p); </script> </h1> <br> <input type="Button" value="Add" onclick="test()" /> </body> </html> Thanks in advance if anyone can help. Is there a best practice to get a lastmodified in local time vs. GMT? Here's the code: Code: var xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", "parks.xml", true); xmlhttp.send(); xmlhttp.onreadystatechange = function() { if(this.readyState == 2) { var updated = (xmlhttp.getResponseHeader("Last-Modified")); //alert(updated); document.getElementById('xml_modified').innerHTML = updated; } } Code: and <li id ="bottom_menu"><a href="parks.xml" target = "_blank">XML</a> Updated: <div id = "xml_modified"></li> Thanks for any help, S |