I am using a browser field to display a web page, however it takes about four times as long to load a page, as compared to the default browser on BlackBerry. I want to speed up this load time.
I found that using a cache can decrease the load time. I use the code from the BlackBerry support forum knowledgebase article "How to Implement a Web Cache for Your BrowserField2 Application", but there is no speedup.
Is there another solution or did I make a mistake in using the cache?
You can minify your code. Minifying code basically removes all excessive characters (mostly whitespaces) to make your file size smaller, thus take less longer to download.
HTML however is usually not minified. I highly suggest to minify your Javascript and CSS only.
Javascript minifier
CSS minifier
Try to reduce the file of images etc, playing with extension and quality. You can also create an alternative CSS that only applies for mobile devices, loading lower quality images (for the images that have been applied in CSS that is) by adding a media type:
<link rel="stylesheet" media="screen" href="default.css" />
<link rel="stylesheet" media="handheld" href="mobile.css" />
Apart from that, there's little you can do. You can't magically increase the download speed of any mobile device so you should try to reduce the size as much as possible.
Related
I just spend the last few hours debugging a huge problem, the problem being,
My external css style sheet were not loading when I used Firefox.
Using Firefoxes debugging tools I was able to conclude that the file was not been found, it had nothing to do with the MIME type or encoding as I checked.
I was using relative URL's to reference my style sheets to I decided to use absolute and it worked! after hours of nearly losing my mind.
However using absolute URL's on every page is just a pain and not practical if I am debugging on localhost all the time.
Could anyone tell me why I need to proved the absolute URL's? The CSS file is there and Firefox states the relative URL and when I go to it manually, it works, however Firefox will just not find it. Every other browser including Chrome and Safari Works with the relative URL's.
I could use php and define all these relative URL's and then reference these within my HTML making it easier to switch domains for debugging but still its a pain and I don't know why I have to do this.
My site here
Thanks in advance,
Jack.
Note : For testing reasons I am giving the link to my site which I am having problems with, nothing to do with advertising.
For your stylesheet problem: change the backslash to a forward slash in your <link> element.
<link rel="stylesheet" href="css/main.css">
There are a couple of images with a similar problem.
You have a number of other errors: <script> tags between <head> and <body>, and some loose </article> tags as well
If you're using Firefox, take a look at the page source and fix anything you see highlighted in red. Then try again.
Lots of questions on jquery accordion. Mine is specific to this site:
http://sabadesignstudio.com/saba/newSMP/index.php
You will probably see that it takes a while to load and while loading, the CSS hasn't quite loaded either.
I just changed hosts to Blue Host today thinking it might be faster on their servers.
Any clues as to how I can make this load normally would be appreciated.
You should link jquery/jquery UI libraries via Google or Microsoft CDNs.
Also, try running YSlow or PageSpeed against your site and evaluate the changes those tools suggest.
Here is the PageSpeed output:
High priority (3)
Serve scaled images
Leverage browser caching
Optimize images
Medium priority (1)
Combine images into CSS sprites
Low priority (10)
Defer parsing of JavaScript
Inline Small CSS
Optimize the order of styles and scripts
Minify CSS
Specify a cache validator
Minify JavaScript
Minify HTML
Specify image dimensions
Specify a character set
Remove query strings from static resources
I'm building a mobile oriented web site.
New phones most of all use new browsers which support html5 and css3. Very often they have touch screens. Probably owner of iPhone4 or Galaxy does not bother about page size so much - so it IMHO it is a good idea to use jQueryMobile for such user.
On the other hand there are smartphones which are also have touch screens but screen resolution is too small (i.e. 240x320) to use jQueryMobile.
There are also a number of phones which do not have touch screens and also there are number of users who switch off Javascript to do not load js files and save their money.
I tried to use Modernizr to determine if mobile phone supports touchscreen but unfortunately Modernizr.touch only shows if a browser support it.
It is known to use CSS Media Query Modernizr.mq() to determine the screen size and load different css files base on it but this solution doesn't solve problem with switched off javascript and old browsers like IE8.
There is also a good article http://www.alistapart.com/articles/return-of-the-mobile-stylesheet but unfortunately it has basically ideas not implementation.
Question: I'd like to load jQuery mobile for smartphones with min-width 480px. Otherwise load default css. It is possible to implement this for as many as possible mobile browsers?
Answer (result code):
<html class="defcss">
<head>
<link href="/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="#Url.Content( "~/Scripts/yepnope.js" )"></script>
<script type="text/javascript">
//<![CDATA[
if (window.screen.availWidth > 450) {
document.documentElement.className = document.documentElement.className.replace(/\bdefcss\b/, '');
yepnope(['//code.jquery.com/jquery-1.6.4.min.js',
'//code.jquery.com/mobile/1.0rc3/jquery.mobile-1.0rc3.min.js',
'//code.jquery.com/mobile/1.0rc3/jquery.mobile-1.0rc3.min.css']);
}
//]]>
</script>
I would look into something server side and generate the files needed, Take a look at:
http://code.google.com/p/mobileesp/
http://blog.mobileesp.com/
http://wurfl.sourceforge.net/
http://www.handsetdetection.com/
There are some client side scripts but I haven't used any of them yet:
https://github.com/sebarmeli/JS-Redirection-Mobile-Site
https://github.com/miohtama/detectmobile.js
Related:
Mobile detection
Also what about Tablets?
Does anyone know of a best practice print document for printing a website in IE6? I have a specific page that needs to be printed and it comes out well in other browsers except IE6 where it is being chopped off by a huge amount on the right side of my page.
Thanks
I have found the most fool-proof method of making something printable is by providing a print button that links to a PDF version of the document.
Generating the PDF is the major task there but that can be quite simple with the right tool.
I use http://www.xhtml2pdf.com/ which is a Python app to take a page and generate a PDF version. It might need some tweaking so you might need a special stylesheet to fix some things.
Other than that, you're left fixing IE. It might help to add a print stylesheet:
<link rel="stylesheet" href="print.css" type="text/css" media="print" />
And overriding some of your more extravagant positioning methods. If you're centring, pull it back to the left, cut out extraneous margins and padding (remember background-images won't render with standard print settings so you can cut out a lot of padding).
You might find there's some crossover (ie you use some of the print styles in your PDF version) so you might be able to generate a hybrid solution to allow people to grab PDF versions and print straight from HTML.
In order to dramatically reduce the number of HTTP requests on my ASP.NET MVC website, I am programmatically merging the files.
Essentially, I have an MVC URL http://localhost/Optimisation/JavaScript/ that calls my controller. The controller reads the javascript files in a certain order, merges them into a single output and renders it on a view.
This works fine.
I am implementing the same concept for the CSS now, using http://localhost/Optimisation/CSS/ - this merges a number of CSS files in a particular order and renders it onto the view.
This works in internet explorer, but in FireFox the styles are all absent. When I "inspect" the CSS file using FireBug it says that the file is empty. The same technique works perfectly in Internet Explorer, so the code behind is working - and if I browse to http://localhost/Optimisation/CSS/ using FireFox, it shows me the raw CSS that I've merged.
I'm referencing the optimised CSS like this:
<link href="http://localhost/Optimisation/CSS/" type="text/css" rel="Stylesheet" />
Make sure the server is sending it with a content-type of text/css.
I think Firefox will put a warning in the error console if it's not (or you can just look at the headers with your tool of choice).