TypeError: tizen.filesystem.openFile is not a function - filesystems

When I run as my web app in Tizen Web Simulator Application(Samsung TV 5.5), I get the exception as followed:
TypeError: tizen.filesystem.openFile is not a function
My source is from here
Here is the source:
function read_file() {
alert('read_file()');
try {
var fileHandleRead = tizen.filesystem.openFile("documents/file", "r");
//console.log("File opened for reading");
alert("File opened for reading");
var fileContent = fileHandleRead.readString();
//console.log("File content: " + fileContent);
alert("File content: " + fileContent);
fileHandleRead.close();
} catch (e) {
alert("read_file exception: " + e);
}
}
appreciated

Tizen Web Simulator is:
suitable for UI development or testing application features which use basic Samsung Product or Tizen APIs.
and
Unlike Samsung TVs and the Samsung TV Emulator, the simulator does not actually run the Samsung TV platform. The simulator is a WebKit-based application that simulates Samsung TV APIs using a JavaScript backend. As a result, the simulator does not support any features that have strict dependencies on TV hardware or core Tizen modules.
According to that some APIs may not work on Simulator.
I suggest you to check features on TV Emulator (at least 5.0 to use tizen.filesystem.openFile()).

Related

Github pages made with create-react-app + react-routers doesn't load in iOS devices

I just finished working on a website project and shared it with some people for them to try, website doesn't render at all in the iOS device, but I can't locale the issue since I don't "own" an iOS device.
I am aware of browserstack but it doesn't help me more than seeing the page not loading with my own eyes.
iOS blank page load screenshot here ( Tried with both safari and google chrome, same issue on iPhone X and 11 Pro )
You can see the project here
Solved the issue:
Problem was that Chrome, Firefox and Safari on iOS devices do not use regexp lookbehind.
replaced: const linkParam = document.URL.match(/(?<=team-builder/).+/g);
with:
const urlSplit = document.URL.split('/');
const linkParam = urlSplit[urlSplit.findIndex((param) => param === 'team-builder') + 1];

How to save a file on shared space in Cordova with Android?

I am using Apache Cordova with cordova-plugin-file to develop some android app. Since Android API 29 (Android 10), apps no longer have access to shared space directly due to privacy issues.
I was storing some pdf file on file:///storage/emulated/0/Download/ from where the user could then open the pdf file.
window.resolveLocalFileSystemURL('file:///storage/emulated/0/Download/', function (dir) {
dir.getFile(filename, { create: true }, function (file) {
file.createWriter(function (fileWriter) {
console.log('Writing content to file')
fileWriter.onwriteend = function () {
console.log('Successful file write...')
}
fileWriter.onerror = onerror
fileWriter.write(DataBlob)
}, onerror)
}, onerror)
}, onerror)
But that stopped working on Android 10.
How can I store now a file to be accessible by the user?
window.resolveLocalFileSystemURL(cordova.file.externalRootDirectory + "/Download" used to work
This should work as is when targeting API 28 (now forbidden by Google Play)
This should work when targeting API 29 with the dev version of the plugin (which has the android:requestLegacyExternalStorage="true"), alternatively you can use the edit-config to add this flag.
This won't work when targeting API 30, as API 30 ignores the android:requestLegacyExternalStorage attribute.
It's important to read the Android Notes before you target API 30. You may need to migrate your files to another folder to maintain access to them when targeting API 30 using the new APIs. Source.
Solution for up to Android 10 (API 29)
Use the dev version of the plugin
cordova plugin rm cordova-plugin-file
cordova plugin add https://github.com/apache/cordova-plugin-file.git
I tested it and it allows me to use cordova.file.externalRootDirectory + "/Download" in Android 10 (API 29)

PDF file download not working in Ipad mobile browsers (both chrome and safari) - Angular JS

I have an Angular JS application. I am trying to download a PDF file in a new tab (which comes from backend) on mobile browsers using the below code.
this.windowHolder.windowObjectReference = window.open("about:blank", "_blank");
this.windowHolder.windowObjectReference.location.href = downloadContentUrl;
where,
windowHolder is an instance of class WindowHolder which is as below.
class WindowHolder {
public intervalTimeID: number;
public intervalCallPopup: number;
public windowObjectReference: any;
constructor() {
this.intervalTimeID = 0;
this.intervalCallPopup = 0;
this.windowObjectReference = null;
}
public close() {
if (this.windowObjectReference !== null) {
this.windowObjectReference.close();
this.windowObjectReference = null;
}
}
}
It is working fine in all devices and browsers except IPAD. Same logic works fine in iphone mobile browsers (both safari and chrome). Issue is with only IPAD browsers.
Issue in IPAD chrome: PDF file gets downloaded but when I try to open it says file is corrupted or damaged.
Issue in IPAD safari: PDF file does not get downloaded at all. Instead browser shows WebKitBlobResource error
I need to fix this code so that I will be able to download PDF even in IPAD browsers. Appreciate your help. Thanks in advance.

getstatuscode is not working with phantomJS

I am testing a web app with loads and loads of web pages and I would like to verify that none of the URLs are broken on every commit. Here is a code snippet.
$page = $this->getSession()->getPage();
$page_URLs = $page->findAll('css', 'header nav ul a');
assertEquals(16, count($page_URLs));
foreach($page_URLs as $pageUrl){
try{
$pageUrl->click();
$statusCode = $this->getSession()->getStatusCode();
echo $pageUrl->getText();
assertEquals(200, $statusCode, "The webpage is not available");
} catch (Exception $ex) {
echo 'Caught exception: ', $ex->getMessage(), "\n";
}
$this->getSession()->back();
}
I was using the Behat, MINK with Goutte driver (as a headless browser) for CI integration (and getStatusCode() was working fine). But most of the functionality on the web app is java script driven therefore I have to move on to PhantomJS which support javascript. But I didn't realise that getStatusCode() doesn't work with PhantomJS.
Has anyone got any idea if I can replace this with something and get the similar result.
PhantomJS support in Behat is realised via the WebDriver protocol (selenium). WebDriver doesn't support inspecting status codes on purpose, as it falls out of scope of emulating user actions.

Silverlight Out of Browser check

I am working on an application that requires running out of browser; How can I test if the application is running Out of Browser?
Use the property on the Application object:
if (System.Windows.Application.Current.IsRuningOutOfBrowser)
{
// The app is out of browser
}

Resources