- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
<!DOCTYPE html> <html> <!-- * Copyright © 2012-2015, Intel Corporation. All rights reserved. * Please see the included README.md file for license terms and conditions. --> <head> <meta charset="UTF-8"> <link rel="stylesheet" type="text/css" href="app_framework/2.1/css/af.ui.min.css"> <link rel="stylesheet" type="text/css" href="app_framework/2.1/css/icons.min.css"> <title>Test App</title> <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- * The "meta viewport" tag (below) helps your app size appropriately to a device's ideal viewport. * Note that Windows device viewports work better when initialized using the @viewport CSS rule. * For a quick overview of "meta viewport" and @viewport, see this article: * http://webdesign.tutsplus.com/tutorials/htmlcss-tutorials/quick-tip-dont-forget-the-viewport-meta-tag * To see how it works, try your app on a real device with and without a "meta viewport" tag. * Additional useful references include: * http://www.quirksmode.org/mobile/viewports.html * http://www.quirksmode.org/mobile/metaviewport/devices.html * https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html --> <!-- <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1"> --> <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=no"> <!-- <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes, minimum-scale=1, maximum-scale=2"> --> <style> /* following three (cascaded) are equivalent to above three meta viewport statements */ /* see http://www.quirksmode.org/blog/archives/2014/05/html5_dev_conf.html */ /* see http://dev.w3.org/csswg/css-device-adapt/ */ @-ms-viewport { width: 100vw ; min-zoom: 100% ; zoom: 100% ; } @viewport { width: 100vw ; min-zoom: 100% zoom: 100% ; } @-ms-viewport { user-zoom: fixed ; min-zoom: 100% ; } @viewport { user-zoom: fixed ; min-zoom: 100% ; } /*@-ms-viewport { user-zoom: zoom ; min-zoom: 100% ; max-zoom: 200% ; } @viewport { user-zoom: zoom ; min-zoom: 100% ; max-zoom: 200% ; }*/ </style> <link rel="stylesheet" href="css/app.css"> <link rel="stylesheet" type="text/css" href="css/index_main.less.css" class="main-less"> <!-- IMPORTANT: Do not include a weinre script tag as part of your release builds! --> <!-- Place your remote debugging (weinre) script URL from the Test tab here, if it does not work below --> <!-- <script src="http://debug-software.intel.com/target/target-script-min.js#insertabiglongfunkynumberfromthexdkstesttab"></script> --> <!-- Recommended location for your JavaScript libraries --> <!-- These library references (below) are just examples to give you the general idea... --> <!-- <script src="lib/mc/hammer.js"></script> --> <!-- <script src="lib/ft/fastclick.js"></script> --> <script src="intelxdk.js"></script> <!-- phantom library, needed for Intel XDK "legacy" container api calls --> <script src="xhr.js"></script> <!-- phantom library, needed for Intel XDK "legacy" container CORS --> <!-- * cordova.js is a phantom lib for "Cordova HTML5 web app," it does nothing in a "Standard HTML5 web app" * Seeing a "Failed to load resource: net::ERR_FILE_NOT_FOUND" message caused by this "cordova.js" script? * The cordova.js script is required if you convert your "Standard HTML5" project into a "Cordova" project. * You can safely ignore the error or comment out this line if you will not be developing a Cordova app. --> <script src="cordova.js" id="xdkJScordova_"></script> <script src="js/app.js"></script> <!-- for your event code, see README and file comments for details --> <script src="js/init-app.js"></script> <!-- for your init code, see README and file comments for details --> <script src="xdk/init-dev.js"></script> <!-- normalizes device and document ready events, see file for details --> <!-- You may substitute jQuery for the App Framework selector library. See http://app-framework-software.intel.com/documentation.php#afui/afui_jquery --> <script type="application/javascript" src="app_framework/2.1/appframework.js"></script> <script type="application/javascript" src="app_framework/2.1/appframework.ui.js" data-ver="1"></script> <script> $.ui.autoLaunch = true; $.ui.useOSThemes = true; $.ui.animateHeaders = false; </script> <script> $.ui.ready(function() { alert("start"); intel.xdk.cache.clearAllCookies(); alert("1"); intel.xdk.cache.clearMediaCache(); alert("2"); intel.xdk.cache.setCookie("thing123","testthing",-1); alert(intel.xdk.cache.getCookie("thing123")); alert("end"); }); </script> </head> <body id="afui"> <!-- IMPORTANT: Do not include a weinre script tag as part of your release builds! --> <!-- Place your remote debugging (weinre) script URL from the Test tab here, if it does not work above --> <!-- <script src="http://debug-software.intel.com/target/target-script-min.js#insertabiglongfunkynumberfromthexdkstesttab"></script> --> <div id="content" class="uwrap"> <div class="upage vertical-col left panel" id="mainpage" data-header="none" data-footer="none"><a class="button widget uib_w_1 d-margins" data-uib="app_framework/button" data-ver="1">Ceci n'est pas une button</a> </div> </div> </body> </html>
When I run this app in debug, "start" is displayed, but "1" is not. I get this error
Uncaught TypeError: Cannot read property 'clearAllCookies' of undefined
In the plugin settings, I have Cordova Device, Globalization, and Splashscreen, as well as XDK Cache and Device enabled.
Help would be very much appreciated.
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
intel.xdk.device is also null
Truly stumped.
Solved. Disabled autolaunch and added this
<script type="text/javascript" language="javascript"> document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { setTimeout(function () { $.ui.launch(); }, 50); } </script>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Based on the index.html file you are showing, I'm betting that the template you used includes an event called "app.Ready" that indicates that all DOM, legacy and Cordova read events have completed. Trigger on that event before you try to access any Cordova or XDK functions, the underlying native system needs to finish initialization before you can call that stuff.
If it's the template I'm thinking of, there should be an xdk/init-dev.js file and there might be a js/init-app.js file and js/app.js file. The first generates the app.Ready event. The last two provide examples of how to init your code. Lots of comments in those files.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page