How to link javascript / css files in main app directory in IOS from html file in ApplicationStorageDirectory in Adobe Air - iphone

I'm using Adobe Air for IOS offline app, and I want to implement a download updates (html files + js,css) feature from within the application. The files would be displayed in a StageWebView component.
Since Apple doesn't allow saving files inside the installation directory, I must use ApplicationStorageDirectory instead to download files into.
I want those download html files to link to .js / .css files already installed within the main application directory (e.g. at myApp.app).
The reason for that is I want to minimize the number of the downloaded (shared) files as much as possible. Is this possible?
EDIT 1:
What I need is something like the following:
Inside ApplicationStoarageDirectory (/Library/Application Support/):
test.html
I need it to link to a css file located inside ApplicationDirectory (installation directory), something like:
<link rel="stylesheet" href="**../../MyApp.app/**CSS/Templates.css" type="text/css" media="screen, mobile" title="main" charset="utf-8">
Thank you.
EDIT 2:
I had to copy everything I need in another place (application storage directory) and load from there.

Related

How To automatically update resourse link in eclipse when files moved to other location

I have imported website template in eclipse using file->import->General->Archive File..Template contains html files and also resource folder which contains CSS Javascript etc.I want to put html file in user folder and resource files in user_resource folder. But the problem i get is eclipse doesn't automatically update links in html file to the resource file.Do i manually update all the links in HTML file or is there any way like dreamweaver to update the links when file get moved to other location? For example i have link
<link href="user/assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
it should automatically update to
<link href="../user_resource/assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
when assets folder move to user_resource folder.
Any help would be appriciated
I have not used dreamweaver much. But I find these links may be useful to solve the problem if someone know how to use dreamweaver.
Try it out...
http://www.whoi.edu/services/stad/classes/DreamWeaver/movingfilesfolders.html
http://help.adobe.com/en_US/dreamweaver/cs/using/WScbb6b82af5544594822510a94ae8d65-7c3ea.html

How can i upload my tempates to concrete5?

I am using c5 for social networking of my members. For front page i have my own templates in which all my css/images/javascript files are involved.How can i upload my template and change the theme.I just want to use my theme.How can i connect all this?
Why don't you create a theme. In your root/themes/, create a folder and name it basically whatever you want, as long as it's not the same as the name of one of the other themes. in that folder, create a default.php and view.php, as well as an "elements" folder where you can store your theme's header.php and footer.php, examples of which can be found in your root/concrete/themes/greensalad.
You could just copy that greensalad folder from root/concrete/themes/ to root/themes/, then change the name of the folder to a unique name for your custom theme -- root/themes/my_custom_theme, for example. After that, modify the new folder's contents however you want to. that's what i would do.
once you've created a theme that includes the required default.php and view.php, as well as your header.php and footer.php, you can create folders inside root/themes/my_custom_theme to store your root/themes/my_custom_theme/js, root/themes/my_custom_theme/css, root/themes/my_custom_theme/images, etc.
Lastly, you have to install your new theme. You can do that on your dashboard at yoursite.com/dashboard/pages/themes/, or, if you don't have pretty urls enabled, yoursite.com/index.php/dashboard/pages/themes/.
After that you should see your custom theme there, at yoursite.com/dashboard/pages/themes/, under "installed themes."
you can grab your .js files from your root/themes/my_custom_theme/js/, and your .css files from your root/themes/my_custom_theme/css/, by including something like the following in your custom theme's header.php, footer.php or default.php.
<link rel="stylesheet" href="<?php echo $this->getThemePath(); ?>/css/my_custom_style.css" />
<script type="text/javascript" src="<?php echo $this->getThemePath(); ?>/js/my_custom_script.js"></script>

make ics file to open iMail program

I uploaded a .ics file on wordpress and created a download link. But when I click download, it opend the file in the browser instead of opening iMail program. What am i missing?
http://cjpfiles.org/?p=299
<div class="storycontent">
download
</div>
it depends on your personal pc/browser settings, just like with any other file suffix (.pdf, .jpg etc)
Search for your pc and operating system, with keywords something like
"default program associate filetype"
http://windows.microsoft.com/en-AU/windows-vista/Change-which-programs-Windows-uses-by-default

iPad loading local HTML into web view with images and javascript

Edit:
So the answer was in this post: Loading javascript into a UIWebView from resources
You'll find everything you need to know for loading an HTML5 app with directories there, just make sure you drop files on your Xcode project clicking the radio button that reads "Create folder references for any added folders". Then just use the code on that links I've added up there.
Thanks to Sergio for the help.
I've been through StackOverflow several times already and none of the code I find there can display the images of my html5 App. The hard part seems to be loading files from different subdirectories. I do not want to throw everything in the root and then use the groups in Xcode because I would have to re-factor a lot of the HTML5 code.
I'd like to build this in as a light container, not have to use PhoneGap. Besides PhoneGap comes with a bigger bagage of bugs (I tested our app and it crashed on the iPad and worked on the iPhone). It's hard enough to deal with the HTML5 side of things and Cocoa Touch.
So here's how I load the HTML page:
[webView loadRequest:[NSURLRequest requestWithURL:
[NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:#"index" ofType:#"html"]isDirectory:NO]]];
I have found some solution that it's getting me closer to "Create folder references for any added folders" when adding the files to the resources folder, I can now see some of the images being loaded. The JS doesn't seem to be working properly. I have tested this app loading it from a URL running on a local server and it does work in that case.
So CSS is obviously working, images too but JS seems to be an issue.
Hopefully I'll find the answer soon.
Old
(this is when I was including the folders the wrong way)
So as you guys don't have to be wondering what am I seeing ( it looks to me like js and images are not loading and I do have subdirectories on the HTML5 app ):
Interesting posts which are related to this:
Loading javascript into a UIWebView from resources
Link to resources inside WebView - iPhone
Indeed, you can load a local HTML in a UIWebView by means of:
– loadHTMLString:baseURL:
The only thing you should be aware of is how to specify the baseURL so that it goes to your local resources directory. So, if you add in your HTML:
<img src="localImage.png" />
<link rel="stylesheet" type="text/css" href="theme.css" />
<script type="text/javascript" src="filename.js"></script>
this will be found among your project resources.
It definitely works. Possibly there is some "issue" with your HTML and javascript source (like, e.g., using subdirectories or absolute URLs).
EDIT:
If you need to organize your resources (images and scripts) in directories inside of the Resources directory of your app, see this S.O. topic.
To get the path to your Resources directory, use:
NSString* filePath = [[NSBundle mainBundle] pathForResource:#"index" ofType:#"html"];
An alternative could be hosting all of your file in the Documents directory of your app (which is reserved for user content). In this case, I suppose you could download an archive of your app and install it in the document directory.

iPhone WebApp cache

I've made a simple Web Application for the iPhone, it's just 6 pages each with an image on it and I use the Cube transition to switch between them, all static content.
I need this to work on an iPod Touch offline, i.e. visit it once, disconnect from WiFi, and then be able to browse the static site.
I'm trying to do this using the HTML5 manifest feature, but I'm clearly doing it wrong?
My Manifest file:
CACHE MANIFEST
index.html
main.css
main.js
Images/Appointments_Page.png
Images/backgroundStripes.png
Images/button.png
Images/button1.png
Images/button1_clicked.png
Images/button2.png
Images/button2_clicked.png
Images/button3.png
Images/button3_clicked.png
Images/button_clicked.png
Images/CloseIcon.png
Images/CloseIcon_pressed.png
Images/Efficacy_Page.png
Images/EfficacyGraph_Page.png
Images/Graph_Icon.png
Images/GraphIcon.png
Images/GraphIcon_pressed.png
Images/Home_Page.png
Images/Tolerability_Page.png
Images/TolerabilityTable_Page.png
Images/WebClipIcon.png
Parts/ButtonHandler.js
Parts/PushButton.js
Parts/setup.js
Parts/StackLayout.js
Parts/Transitions.css
Parts/Transitions.js
Parts/utilities.js
top of my HTML file
<!DOCTYPE HTML>
<html manifest="cache-manifest">
Hey I figured it out, leaving answer here in case it helps anyone else.
The problem I was having was that our server (IIS6) was refusing to serve my manifest file.
I had to add the MIME type ".manifest" using "text/cache-manifest".
Since then it's been caching fine, all 40+ files ranging from 1kb to 200kb.
Hope this helps.
I also wrote some tips on using the Manifest at: http://wecreategames.com/blog/?p=210
Other things to note: You need to reload the app TWICE to get the manifest's new contents, and you need to change the actual content of the manifest to force reloading the containing pages (I do this by changing a comment #v.03 to #v.04, or something similar).
As a note: Apple suggests:
"The HTML file that declares the manifest file ..... is automatically included in the application cache. You do not need to add it to the manifest file."
(https://developer.apple.com/library/content/documentation/iPhone/Conceptual/SafariJSDatabaseGuide/OfflineApplicationCache/OfflineApplicationCache.html#//apple_ref/doc/uid/TP40007256-CH7-SW2)
So it would work with leaving "index.html" out of the manifest list.