blackberry webworks: crash when loading local page into iframe - javascript

in a blackberry webworks application i try to load a page into an iframe that is packaged with the app, but the app keeps crashing (it opens the splash screen and doesnt load anything)
The page i want to load is located at (relative to the index.html of my app):
./pages/help_en/home.html
and i tried to load it with this paths:
pages/help_en/home.html
./pages/help_en/home.html
local:///pages/help_en/home.html
but all of them lead to that crash.
When i load it from an external server, it works fine...
Maybe i should also mention, that it only happens on Smartphones, on PlayBook (Tablet) it works fine.
Any help would be appreciated, thank you in advance!

The below code sample should work to load a local page (within the app) into an iframe. It also uses the same folder structure as yours. It has been tested and packaged into a WebWorks app and loaded onto a device and the page loads properly in the iframe. Along with a main page, ensure that you also include a config.xml file.
<!DOCTYPE html>
<html>
<head>
<title>Iframe</title>
<meta id="viewport" name="viewport"
content="initial-scale=1.0,width=device-width,user-scalable=no,target-densitydpi=device-dpi"/>
<script type="text/javascript">
function changeSrc(){
document.getElementById('theFrame').src = "pages/help_en/home.html";
}
</script>
</head>
<body>
Iframe is below<br/>
<button onclick="changeSrc()">click me</button><br/>
<iframe id="theFrame" src=""></iframe>
</body>
</html>

Related

White and Blank Page Problem in ElectronJs

I'm new at ElectronJs, when I tried to open Go to page, a new page in the same window, it has opened a blank and white page.
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
Chromium <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
Go to page
<script>
// You can also require other files to run in this process
require('./renderer.js')
</script>
</body>
</html>
First, my code was like Go to page and then I changed my code to Go to page.
But this did not fix my problem, still not opening page.html.
I would like to make a multiple page GUI with electronJs, and I don't know how to figure out this white page problem.
Video demonstrating the problem
Files of the Project
i checked console.log() with mainWindow.webContents.openDevTools() and problem is wrong file path. When i opened my project with Electron Fiddle, it didnt took my folder path (C:\Users\Demir\Desktop\Softwares\li_software). Electron Fiddle opened my project from C:\Users\Demir\AppData\Local\Temp\tmp-10260KLe0XorfFNK8. So when i move my page.html or css files to tmp-10260KLe0XorfFNK8 folder, problem solved.

a html page that take advantage of openflashchart cannot be displayed as expected

My test.html file:
<html>
<head>
<title> my title </title>
<script> type="text/javascript" src="/openflashchart/js/swfobject.js"</script>
</head>
<body>
<tr>
<td>
<script type="text/javascript">
swfobject.embedSWF("/openflashchart/open-flash-chart.swf","my_chart","480","360","9.0.0","expressInstall.swf",{"data-file":"data.json"});
</script>
<div id="my_chart"></div>
</td>
</tr>
...blabla
</body>
</html>
I place openflashchart in the home directory of apache, i.e., /Library/WebServer/Documents/. This html file and the json data to be loaded are placed in Documents/Data/myfiles. This page is supposed to be displayed with a curve. However, there is nothing as I visit http://localhost/Data/myfiles/test.html.
Update
Now I know that the reason is that I didn't install Adobe Flash Player, while this package is flash based. Untill now I cannot successfully install Adobe Flash Player on my mac. But that's another problem.
Since chrome has built-in support for flash, this page can be displayed properly with it. I still has probelms with safari and firefox.

Why iOS Safari loads JS file after </html> tag after 30 seconds of HTML loading

To share an interesting observation of <script> tag after </html>.
We have a HTML page which is written in below way:
<html>
<body>...</body>
</html>
<script type="text/javascript" src="js/util.js"> </script>
<script type="text/javascript">
....
</script>
The page is embedded into an iOS app, and we found randomly the page is loaded more than 30seconds.
After diagnostics using Safari Web Inspection feature to record timeline, we found the way of writing the <script> tag after </html> causing mobile Safari or iOS UIWebView to start loading util.js after 30seconds of finishing loading the containing HTML page.
Is there a specific reason of this 30 seconds waiting before loading the util.js?
You shouldn't have any tags outside of the tags, it is pure malformed html syntax.

Visual Studio 13, redirect a HTML5 webpage to external website?

I'm not experienced with Visual Studio 13 at all, but I managed to compile a simple HTML5 website so that it displays in an app.
I run a website, that I'd basically like to integrate into a Windows 8.1 UI app. I've tried code like this:
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="1;url=http://mywebsite.com">
<script type="text/javascript">
window.location.href = "http://mywebsite.com"
</script>
<title>Page Redirection</title>
</head>
<body>
<!-- Note: don't tell people to `click` the link, just tell them that it is a link. -->
If you are not redirected automatically, follow the <a href='http://mywebsite.com'>link to example</a>
</body>
</html>
however it gives me an APPHOST9624 error. Even when I click on the HREF link it fails.
Obviously I'm going about this in the wrong way, so my question is. How do I create a Windows 8.1 store app that simply displays the external website fullscreen?
Edit: You actually want to integrate the website in your store app so this solution won't work for you, just noticed that :) There also seems to be a WebView Control though all examples are in XAML, so it might not be supported in HTML5 apps...
I would recommend you launch the default browser with that new URI, though that would open a new browser instance, not sure if that's what you want in your case. For that, try calling
Windows.System.Launcher.launchUriAsync(uri).done( /* Your success and error handlers */ );
Source

quick jQuery question

Should be a really quick one for you pro's:
I'm learning to use JS, in particular a plugin called (embarassingly) 'Easy Image'.
http://cssglobe.com/post/3783/jquery-plugin-easy-image-or-content-slider
Here's my code:
http://jsfiddle.net/tomperkins/LnES6/
JS files are from here:
http://cssglobe.com/post/3783/jquery-plugin-easy-image-or-content-slider
And obviously jQuery (1.5)
I've stripped it down to the basics and can't figure out why it's not working.
Any tips are much appreciated!
Thanks in advance,
Tom
jquery.js and easySlider.js gets an Server error 500 when the browser tries to load them from
http://customstudiodevelopment.co.uk/jquery-test/
Verify that the files are there and that they can be loaded
http://customstudiodevelopment.co.uk/js/jquery.js
http://customstudiodevelopment.co.uk/js/easySlider.js
Unless both these urls load the right JS files your code will not work ...
As a general tip, get FireBug addon to firefox, with the Net panel I found this error in less than 30 seconds ;)
In menu on the left you have to set your framework to JQuery and in Add resources box add 'Easy Image' script. Then comment out first two <script> tags (you will need them on your site but not on jsFiddle). Also change src attributes in <img> tags to absolute path because there is no images folder nor any images on jsFiddle site.
Edit
This is what you get with <script> tags on your site:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
2<html><head>
3<title>500 Internal Server Error</title>
4</head><body>
5<h1>Internal Server Error</h1>
6<p>The server encountered an internal error
Script doesn't work because there are no scripts on your site (both links are dead).
This is working:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<base href="http://customstudiodevelopment.co.uk"/>
<script type="text/javascript" src="/jquery-test/js/jquery.js"></script>
<script type="text/javascript" src="/jquery-test/js/easySlider.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#slider").easySlider();
});
</script>
<meta charset="utf-8">
<title>jQuery Gallery Test</title>
<link href="/jquery-test/css/style.css" rel="stylesheet" type="text/css" media="all">
</head>
<body>
<div id="slider">
<ul>
<li><img src="/jquery-test/images/Website-Strip_Future.png"></li>
<li><img src="/jquery-test/images/SR-Toomer_small.png"></li>
</ul>
</div>
<!-- /end #slider -->
</body>
</html>
Note, I put the base element in there to test on my desktop. It's not required for it to work on your server, but if it's on your desktop computer, it should work (so you can copy the html into a Notepad file and save with filetype .html and run it locally to test).
It appears as if your file includes (js/css/image) are not pointing to where you want them to be.
Use Firebug to test these types of things. When you open the console, you can inspect the scripts included, including open each included file. In this way, you can doublecheck to make sure the browser is able to get to your included files.
http://getfirebug.com/
http://getfirebug.com/wiki/index.php/Script_Panel
http://getfirebug.com/wiki/index.php/File:Script_Panel.png <<< see del-linkrolls.js close to top, right; that's where you select which file to inspect
When I loaded the page I got an ".ready() is not a function" which would mean you are not loading jQuery. Then again I've never fooled around with jsfiddle

Categories