I am building a simple app for the iPad. As it is easier, I decided to go with HTML and a little bit of JavaScript, but I have hit a wall. How I can check in JavaScript if an image (local image) exists?
This might be useful http://www.irt.org/script/52.htm
Related
Here's what I'm trying to accomplish: displaying a PowerPoint presentation on HTML. The user should be able to start and execute the presentation exactly like when you press the "Start Presentation" button in Microsoft PowerPoint: it goes fullscreen, transitions and animations are played, it goes to the next slide if a duration for the slide is set, on click it goes to the next slide, arrow keys are used for navigating slides and so on. Only need to run the presentation, NOT editing.
I've been looking around and came up with these three approaches:
Creating the viewer from scratch and processing/reading the .pptx file using HTML, CSS and JS, btw is this is feasible?
I know it won't be easy, but it seems it would take a lot of time to develop (I'm just one person working in the project).
Also free or paid approaches both are fine, the more options I get to know the better.
WOPI host, the problem with this is I need a paid Office365 membership.
Embedding using a third party such as Office Online, Google Docs, slides.com, the problem I noticed is that the i-frame they provide lacks from functionality and customization.
So my question is, are there other approaches for this? or is this all there is?
Final Edit: I decided to go with iSpring Converter Pro. Seems like the best option overall
Insane amount of work -> not worth it. But you could use a paid library such as Aspose.Slides
MS WOPI is, indeed, a way to do that. WOPI clients such as Office Online and Office Online Server offer an action called present. That's what you're looking for.
What about SlideShare's API and oEmbed?
Another approach:
Convert the PPTX to ODF and use https://viewerjs.org/
The iOS safari browser has a handy option that appears whenever you open a PDF page in the browser
If you have Adobe Reader installed, a button will appear that says:
Open in "Adobe Reader"...
However, if you open up the PDF document where the HUD (address bar, etc) is hidden, like in a phone gap application, or a quick and dirty "Add to Home Screen app" using the following meta:
<meta name="apple-mobile-web-app-capable" content="yes" />
then, obviously, the button will not appear.
I want to still open the PDF document in Adobe Reader. Does anyone know a way to do this programmatically?
I want to include jsPDF in a phonegap application, and save the results, and this would be the easiest way to do that.
Thanks in advance!
With some fantastic help from Vince Parsons (and others), I've solved this problem.
Using a PhoneGap Plugin, you can create / expose a JavaScript call, which is then processed in Objective-c.
Here's the two lines you need (yes, only two lines!), and a subsequent explanation:
self.docInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:myDocumentPath]];
[self.docInteractionController presentOpenInMenuFromRect:CGRectMake(0,100,1,1) inView:UIApplication.sharedApplication.keyWindow animated:YES];
Explanation
Your input will be the file location.
In my case it's inside the app sandbox, so it looks something like:
/var/mobile/Applications/B16-HU83-GU1D-1D3NT1F13R/Documents/DocumentToExport.pdf
If you want to use an external URL, you can (with adjustments), but for my purposes it was internal.
So, with my file location as an input (let's call my input variable myDocumentPath), you just need to declare a document controller:
self.docInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:myDocumentPath]];
this creates a UIDocumentInteractionController using the interactionControllerWithURL method, which needs an NSURL variable.
We create that NSURL variable using the fileURLWithPath method, passing it our myDocumentPath.
The next line calls presentOpenInMenuFromRect Which takes a rectangle and a viewport:
[self.docInteractionController presentOpenInMenuFromRect:CGRectMake(0,0,1,1) inView:UIApplication.sharedApplication.keyWindow animated:YES];
the rectangle is created at position 0,0 with a width and height of 0,0 (GCRectMake(0,0,1,1))
and the viewport is taken from the PhoneGap application: UIApplication.sharedApplication.keyWindow
I'm reeling with joy and amazement that this only took two lines of code to fix. Granted, there's not a way to do it with JavaScript only, but it's still pretty elegant, and works great.
You can open your PDF using PhoneGap InAppBrowser(http://docs.phonegap.com/en/2.5.0/cordova_inappbrowser_inappbrowser.md.html#InAppBrowser) if the PDF is opend from the server using a URL or if its from local device, you can use the PDFViewer plugin: https://github.com/phonegap/phonegap-plugins/tree/master/iOS/PDFViewer.
Bothways the native default PDF reader will be used to open the PDF.
I really searched for an ready-to-use solution and gave up at one point. There are a few old repositories on GitHub and some articles building on the two lines of the green marked answer - but nothing works satisfying for me.
That's why i forked the cordova-plugin-file-opener2 to change the iOS behavior and this works perfect for me. To allow also parallel usage of the forked plugin, i've renamed it creatively to cordova-plugin-file-opener3. It provides the same features as version 2.0.1 of the forked plugin except that on iOS the "Open In"-Dialog is shown.
The change to the plugin was trivial. Just replaced one method call and did some renaming. Don't know why it was so hard to find a working solution - but maybe that i didn't search the right way.
You can find the repository here:
https://github.com/napolitano/cordova-plugin-file-opener3
Feel free to use it.
I have built an game using HTML and javascript that I want to turn into an ipad app.
I have been following this "Creating a native 'Objective-C' app" section of this guide: http://matt.might.net/articles/how-to-native-iphone-ipad-apps-in-javascript/
However, when I run the ipad simulator in Xcode, the "ipad" comes up, but it just shows a blank screen.
I took out all my code in my html file and just put in a couple of lines of html. When I change the background color, this does show in the ipad simulator.
However no text shows up.
Does anyone know what I'm missing?
I am using Xcode 3. Also, I have already taken my javascript file out of "compile sources" and placed it into "copy bundle resource".
I don't know about your problem but an easy way to create an HTML/JS app is to use PhoneGap. Plus you can bring your app to other OS like Android an a PhoneGap project is really easy to set up.
http://phonegap.com/start
I am somewhat familiar with HTML and Javascript (I have had a few classes covering these in college and dabbled a little on my own). What I would like to do is create a desktop wallpaper on my Windows 7 x64 machine that uses HTML (or whatever I need to use) that runs only on my machine and allows me to use images as links to a few websites(have that working) and shortcuts to run applications that are on my machine. This is the part I am having problems with. I tried using an anchor tag and just placing the file path of the executable but when it is clicked my browser is opened and I am prompted to download the executable. Is there a way to run an executable using HTML, Javascript or something else on my local machine this way.
Also, I have read that this feature has been disabled on Windows 7. I found an application, AveDesktopSites from brothersoft.com that I think may allow me to use an html file as my wallpaper but I have not tried it. Any confirmation or recommendations for other software to do this would be appreciated.
Here is what I have so far(its very simple):
<body>
<a id="StackOverflow" href="websiteURL"> </a>
<a id="Excel" href="filepath to Excel Executable"> </a>
</body>
Then in the CSS file this HTML is using I adjusted the size of each of these anchor tags using their IDs to be the same size as the image and positioned them absolutely over the images to make the images appear to be clickable. I have only tested in my browser at this point.
Thanks in advance.
In windows XP and maybe even in versions before that it was possible to have a website as wallpaper.
You could just have a small block(resizable) with a custom given URL and it would stay on there you could just browse it like it was just another window.
However this option has been removed for Windows Vista and Windows 7.
So what you want now is not possible.
If you use Mozilla Firefox try downloading the addon "Speed dial."
It allows you to have a raster of 3x3 as your home page(you can create several groups all containing 3x3 or any other amount till a certain amount)
And every block in that raster can be a different website.
Gives you the same idea but not as wallpaper.
Its almost the same as bookmarks but just way faster.
I really dont know about any other software but they would have to do things to your windows that shouldnt be possible anymore. So im not sure if that really is what you want. There is probably a reason why Microsoft took it out.
Hope I could be of any help.
http://support.microsoft.com/default.aspx?scid=kb;EN-GB;q232077
I found a similar post containing this link. This looks like it could solve your dilemma if you never found a way.
I did a lot of searching for what I thought would be a pretty common question, but I came up with nothing. If there is another thread with a similar topic, please let me know.
Basically, I'm looking for a way to have an .mp3 file play in a website without relying on a flash-based player. I've searched w3 schools and every forum I can think of, but every media player I've found so far has been some sort of proprietary flash player.
Doesn't HTML support some sort of native player? I've found some that rely on Windows Media Player which is close, but I want the player to work on an iPhone and something tells me WMP won't get that done...
PS, as I'm thinking more about this this idea just popped into my head: a javascipt player and inside the <noscript> tag, put a flash player? I'm running a music blog (# http://www.freshoncampus.com) so the less code per post, the better...
Yes you can, with HTML 5.
This is a pretty good explanation of how you might go about doing this.
The caveat is that HTML5 support is not universal, but iOS devices (iphone) have a good start with supporting HTML5.
Edited to add:
From the question, it's hard to discern if you're looking for a way to play multiple mp3's with a nice gui interface, or just use audio as a background.
For the former, you will need to use Javascript to handle controls, and loading of the src element (I'd search for custom built javascript or jquery plugins to handle this).
For the latter, my solution above will work.
Also, background music in a webpage is highly annoying to most users, so caveat emptor.
You could go with something like http://www.schillmania.com/projects/soundmanager2/
which should autodetect the best option to play the sound.
jplayer? Not sure about MP3/OGG thing though...
First, HTML5's “audio” tag.
Second, you can use “embed” tag — it will play with whatever browser plugin is installed (not just WMP).
Not sure what would work in iPhone, though.
(and I might be wrong about exact tag names)