How to check whether we can run plugin on iphone? Can we check using simulator? - macos

How to check whether we can use plugin on iphone? Can we check using simulator and be assured it will run on the device? my plugin is working successfully on mac.
Now this code works on safari on mac but not on safari on simulator. Can someone tell me why?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 5.0 Transitional//EN" "http://www.w3.org/TR/1999 /REC-html401-19991224/loose.dtd">
<html>
<head>
<title>Sample Speaking Plug-In</title>
<script LANGUAGE="JavaScript">
function print()
{
alert("running"+ document.getElementById('printid'));
//var plugin = document.embeds[0];
var plugin = document.getElementById('printid');
var data = plugin.myPrint();
alert(data);
(document.getElementById('t1')).value = data;
}
</script>
</head>
<body>
<!-- <embed name="print" width="200px" height="400px" type="application/x-printText" ></embed> -->
<object type="application/x-printText" name="print1" id="printid" width="200px" height="400px">
</object>
<input type = "text" value = "horse" id="t1"/>
<input type="button" value="print" onClick="print()"/>
</body>
</html>

thrs no plugin for mobile safari. only for mac its available. Hope I find some alternative to plugin for mobile safari.

Related

Converting working system to a chrome App

After hitting some of the limitations in a standard browser based application, I decided to convert it to a chrome App that doesn't use the browser.
Below are all the relevant parts. The problem I'm trying to solve is to add a load listener for a button that was working in the browser and doesn't work under the app architecture.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>POS Data Entry Sheet</title>
<link href="./POS.css" rel="stylesheet" type="text/css" />
<script src="./POS.js"></script>
<script src="./POS.underDevelopment.js"></script>
<script src="./POS.generateTable.js"></script>
<script src="./POS.menu.js"></script>
<script src="./POS.portion.js"></script>
<script src="./POS.formula.js"></script>
<script src="./POS.dialog.js"></script>
</head>
<body>
<script>
addLoadListener(addHandlerForLoginButton);
</script>
<section id="login">
<h1>Please login:</h1>
<p>
<label>User ID:</label><input type="text" id="userID">
<label>Password:</label><input type="password" id="password">
<button type="submit" id="loginButton">Login</button>
</p>
</section>
<div id="main"></div> <!--Everything gets attached to this div.-->
</body>
</html>
Everything above works via the browser.
I created the manifest:
{
"name": "Point of Sale System",
"description": "Dual currency Point of Sale System",
"version": "0.1",
"app": {
"background": {
"scripts": ["POS.dialog.js",
"POS.formula.js",
"POS.generateTable.js",
"POS.js",
"POS.menu.js",
"POS.portion.js",
"POS.underDevelopment.js",
"background.js"]
}
}
}
This is my first attempt at the background.js
It brings up the rudimentary page, but the in line script wasn't working.
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('POS.html', {
'bounds': {
'width': screen.availWidth,
'height': screen.availHeight
}
});
});
So, I commented out the inline script and attempted to add a callback function
This also doesn't work. No event listeners are recorded as per the debug tool.
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('POS.html', {
'bounds': {
'width': screen.availWidth,
'height': screen.availHeight
}
}, function(win) {win.addEventListener('load', addHandlerForLoginButton, false);});
});
I'm at a loss after several hours of attempting everything I could think of. Why doesn't the original in line script work, and why doesn't the callback work in the Chrome App architecture?
I think you are running into CSP problems, which does not allow inline script or script blocks. See http://developer.chrome.com/apps/contentSecurityPolicy.html for details.
You should be able to convert your first attempt by simply creating a page.js file, including it via a script src='page.js' tag, and put the contents of your script block in it:
addLoadListener(addHandlerForLoginButton);
Your second versoin didn't work because the win parameter to your callback isn't a DOM window but is an AppWindow. It has a DOM window attached via the contentWindow attribute, see http://developer.chrome.com/apps/app_window.html#type-AppWindow for details.
Lastly, you don't need to list all of those scripts in the app.background.scripts field of the manifest, only the background script background.js. The others will be loaded as needed when you open your page.

IBM Worklight v 5.0.6 - Can't navigate multipages on Windows Phone 7.5 environment

Hi I'm having trouble with WP 7.5 application development in IBM Worklight v 5.0.6.
I used MultiPageApp Project from ftp://public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v506/wl_gs_all_samples.zip for my experiment.
There are many problems I had :
First Problem
I built WP 7.5 environment in worklight without editing the code. Then I run it in MS Visual Studio 2012 with Emulator 7.1 256MB. The problem is only the content of from MultiPageApplication.html appeared.
MultiPageApplication.html
<!DOCTYPE html>
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0" name="viewport">
<title>MultiPageApplication</title>
<link href="wlclient/css/wlclient.css" rel="stylesheet">
<link href="images/favicon.png" rel="shortcut icon">
<link href="images/apple-touch-icon.png" rel="apple-touch-icon">
<link href="css/MultiPageApplication.css" rel="stylesheet">
<script>
// Define WL namespace.
var WL = WL ? WL : {};
/**
* WLClient configuration variables.
* Values are injected by the deployer that packs the gadget.
*/
WL.StaticAppProps = {
"APP_DISPLAY_NAME": "MultiPageApplication",
"APP_SERVICES_URL": "http:\/\/169.254.17.188:8080\/apps\/services\/",
"APP_VERSION": "1.0",
"ENVIRONMENT": "windowsphone",
"LOGIN_DISPLAY_TYPE": "embedded",
"WORKLIGHT_ROOT_URL": "http:\/\/169.254.17.188:8080\/apps\/services\/api\/MultiPageApplication\/windowsphone\/"
};</script>
<script src="wlclient/js/cordova.js"></script>
<script src="common/js/wljq.js"></script>
<script src="common/js/base.js"></script>
<script src="wlclient/js/messages.js"></script>
<script src="common/js/wlcommon.js"></script>
<script src="wlclient/js/diagnosticDialog.js"></script>
<script src="wlclient/js/deviceAuthentication.js"></script>
<script src="wlclient/js/window.js"></script>
<script src="wlclient/js/worklight.js"></script>
<script src="wlclient/js/wlclient.js"></script>
<script src="wlclient/js/wlfragments.js"></script>
<script src="wlclient/js/encryptedcache.js"></script>
<script src="wlclient/js/jsonstore/jsonstore.js"></script>
<script src="wlclient/js/challengeHandlers/antiXSRFChallengeHandler.js"></script>
<script src="wlclient/js/challengeHandlers/authenticityChallengeHandler.js"></script>
<script src="wlclient/js/challengeHandlers/deviceAuthAutoProvisioningChallengeHandler.js"></script>
<script src="wlclient/js/challengeHandlers/deviceAuthNoProvisioningChallengeHandler.js"></script>
<script src="wlclient/js/challengeHandlers/remoteDisableChallengeHandler.js"></script>
<script src="wlclient/js/wlgap-wp7.js"></script><script>window.$ = window.jQuery = WLJQ;</script>
</head>
<body id="content" style="display: none">
<div id="AppBody">
<!-- This is static header, it will be shown always -->
<div id="header">
<h1>Multi page app</h1>
</div>
<!-- This is a placeholder for dynamic page content -->
<div id="pagePort"></div>
</div>
<script src="js/initOptions.js"></script>
<script src="js/MultiPageApplication.js"></script>
<script src="js/messages.js"></script>
</body>
</html>
MultiPageApplication.js
var pagesHistory = [];
var currentPage = {};
function wlCommonInit(){
$("#pagePort").load("pages/MainPage.html", function(){
currentPage.init();
});
}
At last I solve this by change the URL of jquery load API (manually in MS Visual Studio 2012) from
$("#pagePort").load("pages/MainPage.html",
to
$("#pagePort").load("default/pages/MainPage.html",
Although the code is working, another problem is
Files in native/www are regenerated every time the application is
built, so any changes made to these files are lost.
what should I do to make the URL correctly generated?
Second Problem
When I want to navigate page from MainPage.html to Page1.html by pressing the "Load Page1" button,
the Page1.html won't load because the method 'init' in MultiPageApplication.js doesn't work. And I got this error from the output log in MS Visual Studio 2012:
Log:"Error in error callback: File564653615 = TypeError: Object doesn't support property or method 'init'"
I've tried changing the jQuery embedded in Worklight with jQueryMobile jquery-1.9.1.min.js and jquery.mobile-1.3.2.min.js, but the same problem occured.
so, how should I fix this problem? Is it because the jQuery embedded in Worklight doesn't work in Visual Studio?
Thanks
Please try the solution described here: jQuery Mobile changePage() not working in Windows Phone
Namely:
open jquery.mobile-1.3.2.js and refactor the following:
- var uri = url ? this.parseUrl( url ) : location,
- hash = this.parseUrl( url || location.href ).hash;
+ var uri = this.parseUrl( url || location.href ),
+ hash = uri.hash;
and:
- return uri.protocol + "//" + uri.host + uri.pathname + uri.search + hash;
+ return uri.protocol + uri.doubleSlash + uri.host + uri.pathname + uri.search + hash;
Note that I only checked this with the changePage method, but hopefully this fixes the file location for everything, including what you are experiencing.
Note: Be sure to return the application to its original state.

Simple desktop gadget won't save its data between runs

I'm trying to write a very simple Windows 7 gadget, which is easy enough. But I can't get any of the data I'm saving with System.Gadget.Settings.write/read (writeString/readString) to persist between runs of the gadget. I know it can be done, because all the other Microsoft gadgets do it. I'm obviously missing something crucial, but can't see it.
This is a very simple cut down example:
<html>
<head>
<meta http-equiv="MSThemeCompatible" CONTENT="yes" />
<meta http-equiv="Content-Type" content="text/html; charset=Unicode" />
<title>test</title>
<script type="text/javascript">
function save() {
var e = document.getElementById("name");
if (e && e.value) {
System.Gadget.Settings.write("name", e.value);
prompt("turnedout", System.Gadget.Settings.read("name"));
}
}
function load() {
var t = System.Gadget.Settings.read("name");
prompt("turnedout", t);
}
</script>
</head>
<body scroll="no" unselectable="on" onload='load()'>
<label for='name'>Name</label>
<input id='name'>
<input type="button" value='Save' onclick='save()' />
</body>
</html>
I've traced through the code and everything appears to go in the right places. What's missing?
Gadgets don't work like desktop applications with regard to settings. The settings are per instance of a gadget. Close the instance and you lose the settings. There are other limitations as well. There's a good explanation at: http://dotnetslackers.com/articles/net/SettingsManagerforWindowsVistaSidebarGadgets.aspx
Even I had the same issue, but when I moved the System.Gadget.Settings.write("name", e.value); to the html which is specified in the gadget.xml file, it wrote to the settings.ini file properly

Phonegap-0.94, Apple iPhone OS 4.2.1 : Youtube links not launching Youtube app

I created a basic project using phonegap. and added this bit of html code to my index.hmtl
Clicking on the youtube link launches Youtube mobile site in Phonegap (once it's launched, there is no way to go back to my phonegap view)
How do I enable HREF links to open native youtube app on iPhone/iPad?
The href links are compliant with Apple specs for Youtube Links as in
https://developer.apple.com/library/safari/#featuredarticles/iPhoneURLScheme_Reference/Articles/YouTubeLinks.html
My Index.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
TR/html4/strict.dtd">
<html>
<head>
<!-- Change this if you want to allow scaling -->
<meta name="viewport" content="width=default-width; user-
scalable=no" />
<meta http-equiv="Content-type" content="text/html;
charset=utf-8">
<title>MyTube</title>
<!-- iPad/iPhone specific css below, add after your main css >
<link rel="stylesheet" media="only screen and (max-device-width:
1024px)" href="ipad.css" type="text/css" />
<link rel="stylesheet" media="only screen and (max-device-width:
480px)" href="iphone.css" type="text/css" />
-->
<!-- If you application is targeting iOS BEFORE 4.0 you MUST put
json2.js from http://www.JSON.org/json2.js into your www directory and
include it here -->
<script type="text/javascript" charset="utf-8" src="phonegap.
0.9.4.min.js"></script>
<script type="text/javascript" charset="utf-8">
// If you want to prevent dragging, uncomment this section
/*
function preventBehavior(e)
{
e.preventDefault();
};
document.addEventListener("touchmove", preventBehavior, false);
*/
function onBodyLoad()
{
document.addEventListener("deviceready",onDeviceReady,false);
}
/* When this function is called, PhoneGap has been initialized and is
ready to roll */
function onDeviceReady()
{
// do your thing!
}
</script>
</head>
<body onload="onBodyLoad()">
<h1> My You tube Links </h1>
<a href="http://www.youtube.com/v/NkTrG-gpIzE"> SOURCE-CODE
Trailer </a>
</body>
</html>
I tried and got the same result. Which is weird, because I also assumed links to YT would trigger the native YouTube app. The one thing I found is that an embed will do what you're after, but haven't come across any other way.
<object width="300" height="199">
<param name="movie" value="http://www.youtube.com/v/NkTrG-gpIzE?fs=1&hl=en_US&rel=0"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/NkTrG-gpIzE?fs=1&hl=en_US&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="300" height="199"></embed>
</object>
My only other suggestion was to have you post on the PhoneGap Google Group, but I see that you've just done that a few minutes ago. If I find anything else I'll try to share it, but the embed approach has been the only one that's worked so far.

Firefox 4: How does File.url work?

Did it as stated at this page, but got undefined in my Firefox 4 Beta 7.
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
function read(files) {
var myFile = files[0];
document.write(myFile.url);
}
</script>
</head>
<body>
<input type="file" onchange="read(this.files);" />
</body>
</html>
I think this page will be more useful ;)
I don't know why it isn't working in the current beta. I don't think the standard is very stable yet, so file.url might have been removed since the article was written. I can't find anything about it in the current API draft.
It seems you get the same type of url in FF 4 beta 7 if you use createBlobURL(myFile) instead of myFile.url

Resources