Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 07, 2010 11:41 PM by plkilroy
Member
226 Points
71 Posts
Mar 17, 2007 06:30 AM|LINK
just wanted to present sum code that will maby help sum1 understand the differences between wap 1.1(wml) and wap 2.0(XHTML) and normal (HTML)
errr, laymens terms- difference between web applications, and mobile web applications. i did this in Visual Web Dev 2005 Express Edition.
compile the code, copy it to your server, then view it from IE or mobile phone or any wap browser (klondike,m3gate,openwave,etc)
<script class=st runat="> public void Page_Load(Object sender, EventArgs e) { Response.CacheControl = "private"; Response.Charset = "UTF-8"; Response.Expires = 0; MobileCapabilities currentCapabilities = (MobileCapabilities)Request.Browser; String prefMime = currentCapabilities.PreferredRenderingMime; string page_title = "Capabilities"; string accept = Request.ServerVariables["HTTP_ACCEPT"]; string mime = ""; if (prefMime == "text/html") { mime = "text/html"; } else if (prefMime == "text/vnd.wap.wml") { mime = "text/vnd.wap.wml"; } if (accept.Contains("application/vnd.wap.xhtml+xml")) { mime = "text/html"; } if (mime == "text/html") { Response.ContentType = "text/html"; Response.Write(HTML_head(page_title)); } else if (mime == "text/vnd.wap.wml") { Response.ContentType = "text/vnd.wap.wml"; Response.Write(WML_head(page_title)); } } private string HTML_head(string page_title) { string page_head = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\"" + "\"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">" + "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">" + "<head><title>" + page_title + "</title>" + "<link href=\"style.css\" rel=\"stylesheet\" type=\"text/css\" />" + "</head><body><div>" + HTML_PageContent() + "</div></body></html>"; return page_head; } private string WML_head(string page_title) { string page_head = "<?xml version='1.0'?>" + "<!DOCTYPE wml PUBLIC '-//WAPFORUM//DTD WML 1.1//EN'" + "'http://www.wapforum.org/DTD/wml_1.1.xml'><wml><head>" + "<meta http-equiv=\"Cache-Control\" content=\"max-age=0\" /></head>" + "<card title=\"" + page_title + "\"><p>" + WML_PageContent() + "</p></card></wml>"; return page_head; } private string HTML_PageContent() { string HTML_content = "[<b>Html supported browser]</b>" + Capabilities(); return HTML_content; } private string WML_PageContent() { string WMLcontent = "[<b>WML 1.1 browser]</b>" + Capabilities(); return WMLcontent; } private string Capabilities() { MobileCapabilities currentCapabilities = (MobileCapabilities)Request.Browser; String prefMime = currentCapabilities.PreferredRenderingMime; string capabil = "<br/>Screen Width (chars): " + currentCapabilities.ScreenCharactersWidth.ToString() + "<br/>Screen Height (chars): " + currentCapabilities.ScreenCharactersHeight.ToString() + "<br/>Screen Pixels Width (pixels): " + currentCapabilities.ScreenPixelsWidth.ToString() + "<br/>Screen Pixels Height (pixels): " + currentCapabilities.ScreenPixelsHeight.ToString() + "<br/>Platform: " + currentCapabilities.Platform.ToString() + "<br/>Mobile Manufacturer: " + currentCapabilities.MobileDeviceManufacturer + "<br/>Supports body color: " + currentCapabilities.SupportsBodyColor + "<br/>Supports JavaScript: " + currentCapabilities.JavaScript + "<br/>IsMobileDevice: " + currentCapabilities.IsMobileDevice + "<br/>Id: " + currentCapabilities.Id + "<br/>GateWayVersion: " + currentCapabilities.GatewayVersion + "<br/>IsWebCrawler: " + currentCapabilities.Crawler + "<br/>Supports Cookies: " + currentCapabilities.Cookies + "<br/>Supports BackGroundSounds: " + currentCapabilities.BackgroundSounds + "<br/>Supports ActiveXControls: " + currentCapabilities.ActiveXControls + "<br/>NumberOf SoftKeys: " + currentCapabilities.NumberOfSoftkeys + "<br/>MobileDeviceModel: " + currentCapabilities.MobileDeviceModel + "<br/>Page Content-Type: " + Response.ContentType.ToString(); return capabil; } </script>
Mar 17, 2007 08:22 AM|LINK
weird, it cut off the top portion of my script, but the top 3 lines should read:
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web.Mobile" %>
<script runat="server">
and finally at the bottom should be the ending script tag:
</script>
Participant
810 Points
377 Posts
Mar 18, 2007 09:43 AM|LINK
Hi jamsweb, you helped with an issue re PrefferedRendingMime recently; http://forums.asp.net/thread/1621309.aspx thanks again.
My objective is very simple to serve correct content to moble devices, easier said then done! This script could be what im looking for.
I want to filter all Xhtml browsers web and mobile that receive CSS and those WAP browsers that recieve wml1.1 dtd
I compiled the above code with heading
<%@ Page Language="C#" Inherits="System.Web.UI.MobileControls.MobilePage" %> <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> <%@ Import Namespace="System.Web.Mobile" %>
and changed; string capabil = (to capabilties) and return capabil also.
There is a compilation error however :( hoping you can help Paul
CS0117: 'string' does not contain a definition for 'Contains'
Line 32: if (accept.Contains("application/vnd.wap.xhtml+xml"))
Mar 18, 2007 10:19 PM|LINK
i will try to paste the right code in here from top to bottom:
<%@ Page Language="C#" %> <%@ Import Namespace="System.Web.Mobile" %> <script runat="server"> public void Page_Load(Object sender, EventArgs e) { Response.CacheControl = "private"; Response.Charset = "UTF-8"; Response.Expires = 0;
MobileCapabilities currentCapabilities = (MobileCapabilities)Request.Browser; String prefMime = currentCapabilities.PreferredRenderingMime; string page_title = "Capabilities"; string accept = Request.ServerVariables["HTTP_ACCEPT"]; string mime = "";
if (prefMime == "text/html") { mime = "text/html"; } else if (prefMime == "text/vnd.wap.wml") { mime = "text/vnd.wap.wml"; } if (accept.Contains("application/vnd.wap.xhtml+xml")) { mime = "text/html"; }
if (mime == "text/html") { Response.ContentType = "text/html"; Response.Write(HTML_head(page_title)); } else if (mime == "text/vnd.wap.wml") { Response.ContentType = "text/vnd.wap.wml"; Response.Write(WML_head(page_title));
}
} private string HTML_head(string page_title) { string page_head = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\"" + "\"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">" + "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">" + "<head><title>" + page_title + "</title>" + "<link href=\"style.css\" rel=\"stylesheet\" type=\"text/css\" />" + "</head><body><div>" + HTML_PageContent() + "</div></body></html>"; return page_head; }
private string WML_head(string page_title) { string page_head = "<?xml version='1.0'?>" + "<!DOCTYPE wml PUBLIC '-//WAPFORUM//DTD WML 1.1//EN'" + "'http://www.wapforum.org/DTD/wml_1.1.xml'><wml><head>" + "<meta http-equiv=\"Cache-Control\" content=\"max-age=0\" /></head>" + "<card title=\"" + page_title + "\"><p>" + WML_PageContent() + "</p></card></wml>"; return page_head; }
private string HTML_PageContent() { string HTML_content = "[<b>Html supported browser]</b>" + Capabilities(); return HTML_content; }
private string WML_PageContent() { string WMLcontent = "[<b>WML 1.1 browser]</b>" + Capabilities(); return WMLcontent; } private string Capabilities() { MobileCapabilities currentCapabilities = (MobileCapabilities)Request.Browser; String prefMime = currentCapabilities.PreferredRenderingMime;
string capabil = "<br/>Screen Width (chars): " + currentCapabilities.ScreenCharactersWidth.ToString() + "<br/>Screen Height (chars): " + currentCapabilities.ScreenCharactersHeight.ToString() + "<br/>Screen Pixels Width (pixels): " + currentCapabilities.ScreenPixelsWidth.ToString() + "<br/>Screen Pixels Height (pixels): " + currentCapabilities.ScreenPixelsHeight.ToString() + "<br/>Platform: " + currentCapabilities.Platform.ToString() + "<br/>Mobile Manufacturer: " + currentCapabilities.MobileDeviceManufacturer + "<br/>Supports body color: " + currentCapabilities.SupportsBodyColor + "<br/>Supports JavaScript: " + currentCapabilities.JavaScript + "<br/>IsMobileDevice: " + currentCapabilities.IsMobileDevice + "<br/>Id: " + currentCapabilities.Id + "<br/>GateWayVersion: " + currentCapabilities.GatewayVersion + "<br/>IsWebCrawler: " + currentCapabilities.Crawler + "<br/>Supports Cookies: " + currentCapabilities.Cookies + "<br/>Supports BackGroundSounds: " + currentCapabilities.BackgroundSounds + "<br/>Supports ActiveXControls: " + currentCapabilities.ActiveXControls + "<br/>NumberOf SoftKeys: " + currentCapabilities.NumberOfSoftkeys + "<br/>MobileDeviceModel: " + currentCapabilities.MobileDeviceModel + "<br/>Page Content-Type: " + Response.ContentType.ToString(); return capabil; }
Mar 18, 2007 10:29 PM|LINK
ok the copy and paste thing not working out for me lol, the above code is correct except replace < with <
(the left angle bracket)
Mar 18, 2007 10:56 PM|LINK
plkilroy, are you using Visual Web Developer 2005 express edition and .net 2.0?
'Contains' lives in class 'String' which is in namespace 'System'
Mar 19, 2007 01:04 AM|LINK
Hi jansweb, yes I use VWD 05 express and .net2.0 for dev. Did your system compile this script, with those changes i still return CS0117: 'string' does not contain a definition for 'Contains'
cheers Paul
Mar 19, 2007 02:04 AM|LINK
Mar 19, 2007 02:37 AM|LINK
Hi jansweb, i checked my system and see it running
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
I had updated system to .net framework 2, this doesnt appear to be running! so I guess I have to sort this out,
However I tested this script remotely, and it is picking up text/html correctly, but using Nokia 7210 sdk for checking WML the dtd wont serve.
private string WML_head(string page_title) { string page_head = <?xml version='1.0'?>" + <!DOCTYPE wml PUBLIC '-//WAPFORUM//DTD WML 1.1//EN'" + "'http://www.wapforum.org/DTD/wml_1.1.xml'><wml><head>" + <meta http-equiv=\"Cache-Control\" content=\"max-age=0\" /></head>" + <card title=\"" + page_title + "\"><p>" + WML_PageContent() + </p></card></wml>"; return page_head; }
Much thanks for your time as this is a major concern for anyone rendering content to mobile devices, cheers Paul
Mar 19, 2007 07:37 AM|LINK
ok i had to dig out my nokia 7210 to fix this, it was 2 small errors in the WML_head(string page_title)
first there needs to be a space right after EN
"<!DOCTYPE wml PUBLIC '-//WAPFORUM//DTD WML 1.1//EN'" +
and the second problem was when i pasted the code to this forum it changed a angle bracket to: >
<card title=\"" + page_title + "\"><p>" + WML_PageContent() +
and i also chose to use double quotes in the doctype this time around so here is the new method:
private string WML_head(string page_title)
{
string page_head = "<?xml version=\"1.0\"?>" +
"<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" " +
"\"http://www.wapforum.org/DTD/wml_1.1.xml\"><wml><head>" +
"<meta http-equiv=\"Cache-Control\" content=\"max-age=0\" /></head>" +
"<card title=\"" + page_title + "\"><p>" + WML_PageContent() +
"</p></card></wml>";
return page_head;
jamsweb
Member
226 Points
71 Posts
ASP.NET web pages or mobile forms?
Mar 17, 2007 06:30 AM|LINK
just wanted to present sum code that will maby help sum1 understand the differences between wap 1.1(wml) and wap 2.0(XHTML) and normal (HTML)
errr, laymens terms- difference between web applications, and mobile web applications. i did this in Visual Web Dev 2005 Express Edition.
compile the code, copy it to your server, then view it from IE or mobile phone or any wap browser (klondike,m3gate,openwave,etc)
<script class=st runat="> public void Page_Load(Object sender, EventArgs e) { Response.CacheControl = "private"; Response.Charset = "UTF-8"; Response.Expires = 0; MobileCapabilities currentCapabilities = (MobileCapabilities)Request.Browser; String prefMime = currentCapabilities.PreferredRenderingMime; string page_title = "Capabilities"; string accept = Request.ServerVariables["HTTP_ACCEPT"]; string mime = ""; if (prefMime == "text/html") { mime = "text/html"; } else if (prefMime == "text/vnd.wap.wml") { mime = "text/vnd.wap.wml"; } if (accept.Contains("application/vnd.wap.xhtml+xml")) { mime = "text/html"; } if (mime == "text/html") { Response.ContentType = "text/html"; Response.Write(HTML_head(page_title)); } else if (mime == "text/vnd.wap.wml") { Response.ContentType = "text/vnd.wap.wml"; Response.Write(WML_head(page_title)); } } private string HTML_head(string page_title) { string page_head = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\"" + "\"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">" + "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">" + "<head><title>" + page_title + "</title>" + "<link href=\"style.css\" rel=\"stylesheet\" type=\"text/css\" />" + "</head><body><div>" + HTML_PageContent() + "</div></body></html>"; return page_head; } private string WML_head(string page_title) { string page_head = "<?xml version='1.0'?>" + "<!DOCTYPE wml PUBLIC '-//WAPFORUM//DTD WML 1.1//EN'" + "'http://www.wapforum.org/DTD/wml_1.1.xml'><wml><head>" + "<meta http-equiv=\"Cache-Control\" content=\"max-age=0\" /></head>" + "<card title=\"" + page_title + "\"><p>" + WML_PageContent() + "</p></card></wml>"; return page_head; } private string HTML_PageContent() { string HTML_content = "[<b>Html supported browser]</b>" + Capabilities(); return HTML_content; } private string WML_PageContent() { string WMLcontent = "[<b>WML 1.1 browser]</b>" + Capabilities(); return WMLcontent; } private string Capabilities() { MobileCapabilities currentCapabilities = (MobileCapabilities)Request.Browser; String prefMime = currentCapabilities.PreferredRenderingMime; string capabil = "<br/>Screen Width (chars): " + currentCapabilities.ScreenCharactersWidth.ToString() + "<br/>Screen Height (chars): " + currentCapabilities.ScreenCharactersHeight.ToString() + "<br/>Screen Pixels Width (pixels): " + currentCapabilities.ScreenPixelsWidth.ToString() + "<br/>Screen Pixels Height (pixels): " + currentCapabilities.ScreenPixelsHeight.ToString() + "<br/>Platform: " + currentCapabilities.Platform.ToString() + "<br/>Mobile Manufacturer: " + currentCapabilities.MobileDeviceManufacturer + "<br/>Supports body color: " + currentCapabilities.SupportsBodyColor + "<br/>Supports JavaScript: " + currentCapabilities.JavaScript + "<br/>IsMobileDevice: " + currentCapabilities.IsMobileDevice + "<br/>Id: " + currentCapabilities.Id + "<br/>GateWayVersion: " + currentCapabilities.GatewayVersion + "<br/>IsWebCrawler: " + currentCapabilities.Crawler + "<br/>Supports Cookies: " + currentCapabilities.Cookies + "<br/>Supports BackGroundSounds: " + currentCapabilities.BackgroundSounds + "<br/>Supports ActiveXControls: " + currentCapabilities.ActiveXControls + "<br/>NumberOf SoftKeys: " + currentCapabilities.NumberOfSoftkeys + "<br/>MobileDeviceModel: " + currentCapabilities.MobileDeviceModel + "<br/>Page Content-Type: " + Response.ContentType.ToString(); return capabil; } </script>jamsweb
Member
226 Points
71 Posts
Re: ASP.NET web pages or mobile forms?
Mar 17, 2007 08:22 AM|LINK
weird, it cut off the top portion of my script, but the top 3 lines should read:
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web.Mobile" %>
<script runat="server">
and finally at the bottom should be the ending script tag:
</script>
plkilroy
Participant
810 Points
377 Posts
Re: ASP.NET web pages or mobile forms?
Mar 18, 2007 09:43 AM|LINK
Hi jamsweb, you helped with an issue re PrefferedRendingMime recently; http://forums.asp.net/thread/1621309.aspx thanks again.
My objective is very simple to serve correct content to moble devices, easier said then done! This script could be what im looking for.
I want to filter all Xhtml browsers web and mobile that receive CSS and those WAP browsers that recieve wml1.1 dtd
I compiled the above code with heading
<%@ Page Language="C#" Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
<%@ Import Namespace="System.Web.Mobile" %>
and changed; string capabil = (to capabilties) and return capabil also.
There is a compilation error however :( hoping you can help Paul
CS0117: 'string' does not contain a definition for 'Contains'
Line 32: if (accept.Contains("application/vnd.wap.xhtml+xml"))
jamsweb
Member
226 Points
71 Posts
Re: ASP.NET web pages or mobile forms?
Mar 18, 2007 10:19 PM|LINK
i will try to paste the right code in here from top to bottom:
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web.Mobile" %>
<script runat="server">
public void Page_Load(Object sender, EventArgs e)
{
Response.CacheControl = "private";
Response.Charset = "UTF-8";
Response.Expires = 0;
MobileCapabilities currentCapabilities
= (MobileCapabilities)Request.Browser;
String prefMime = currentCapabilities.PreferredRenderingMime;
string page_title = "Capabilities";
string accept = Request.ServerVariables["HTTP_ACCEPT"];
string mime = "";
if (prefMime == "text/html")
{
mime = "text/html";
}
else if (prefMime == "text/vnd.wap.wml")
{
mime = "text/vnd.wap.wml";
}
if (accept.Contains("application/vnd.wap.xhtml+xml"))
{
mime = "text/html";
}
if (mime == "text/html")
{
Response.ContentType = "text/html";
Response.Write(HTML_head(page_title));
}
else if (mime == "text/vnd.wap.wml")
{
Response.ContentType = "text/vnd.wap.wml";
Response.Write(WML_head(page_title));
}
}
private string HTML_head(string page_title)
{
string page_head = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\"" +
"\"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">" +
"<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">" +
"<head><title>" + page_title + "</title>" +
"<link href=\"style.css\" rel=\"stylesheet\" type=\"text/css\" />" +
"</head><body><div>" + HTML_PageContent() + "</div></body></html>";
return page_head;
}
private string WML_head(string page_title)
{
string page_head = "<?xml version='1.0'?>" +
"<!DOCTYPE wml PUBLIC '-//WAPFORUM//DTD WML 1.1//EN'" +
"'http://www.wapforum.org/DTD/wml_1.1.xml'><wml><head>" +
"<meta http-equiv=\"Cache-Control\" content=\"max-age=0\" /></head>" +
"<card title=\"" + page_title + "\"><p>" + WML_PageContent() +
"</p></card></wml>";
return page_head;
}
private string HTML_PageContent()
{
string HTML_content = "[<b>Html supported browser]</b>" +
Capabilities();
return HTML_content;
}
private string WML_PageContent()
{
string WMLcontent = "[<b>WML 1.1 browser]</b>" +
Capabilities();
return WMLcontent;
}
private string Capabilities()
{
MobileCapabilities currentCapabilities
= (MobileCapabilities)Request.Browser;
String prefMime = currentCapabilities.PreferredRenderingMime;
string capabil = "<br/>Screen Width (chars): " + currentCapabilities.ScreenCharactersWidth.ToString() +
"<br/>Screen Height (chars): " + currentCapabilities.ScreenCharactersHeight.ToString() +
"<br/>Screen Pixels Width (pixels): " + currentCapabilities.ScreenPixelsWidth.ToString() +
"<br/>Screen Pixels Height (pixels): " + currentCapabilities.ScreenPixelsHeight.ToString() +
"<br/>Platform: " + currentCapabilities.Platform.ToString() +
"<br/>Mobile Manufacturer: " + currentCapabilities.MobileDeviceManufacturer +
"<br/>Supports body color: " + currentCapabilities.SupportsBodyColor +
"<br/>Supports JavaScript: " + currentCapabilities.JavaScript +
"<br/>IsMobileDevice: " + currentCapabilities.IsMobileDevice +
"<br/>Id: " + currentCapabilities.Id +
"<br/>GateWayVersion: " + currentCapabilities.GatewayVersion +
"<br/>IsWebCrawler: " + currentCapabilities.Crawler +
"<br/>Supports Cookies: " + currentCapabilities.Cookies +
"<br/>Supports BackGroundSounds: " + currentCapabilities.BackgroundSounds +
"<br/>Supports ActiveXControls: " + currentCapabilities.ActiveXControls +
"<br/>NumberOf SoftKeys: " + currentCapabilities.NumberOfSoftkeys +
"<br/>MobileDeviceModel: " + currentCapabilities.MobileDeviceModel +
"<br/>Page Content-Type: " + Response.ContentType.ToString();
return capabil;
}
</script>
jamsweb
Member
226 Points
71 Posts
Re: ASP.NET web pages or mobile forms?
Mar 18, 2007 10:29 PM|LINK
ok the copy and paste thing not working out for me lol, the above code is correct except replace < with <
(the left angle bracket)
jamsweb
Member
226 Points
71 Posts
Re: ASP.NET web pages or mobile forms?
Mar 18, 2007 10:56 PM|LINK
plkilroy, are you using Visual Web Developer 2005 express edition and .net 2.0?
'Contains' lives in class 'String' which is in namespace 'System'
plkilroy
Participant
810 Points
377 Posts
Re: ASP.NET web pages or mobile forms?
Mar 19, 2007 01:04 AM|LINK
Hi jansweb, yes I use VWD 05 express and .net2.0 for dev. Did your system compile this script, with those changes i still return CS0117: 'string' does not contain a definition for 'Contains'
cheers Paul
jamsweb
Member
226 Points
71 Posts
Re: ASP.NET web pages or mobile forms?
Mar 19, 2007 02:04 AM|LINK
plkilroy
Participant
810 Points
377 Posts
Re: ASP.NET web pages or mobile forms?
Mar 19, 2007 02:37 AM|LINK
Hi jansweb, i checked my system and see it running
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
I had updated system to .net framework 2, this doesnt appear to be running! so I guess I have to sort this out,
However I tested this script remotely, and it is picking up text/html correctly, but using Nokia 7210 sdk for checking WML the dtd wont serve.
private string WML_head(string page_title)
{
string page_head = <?xml version='1.0'?>" +
<!DOCTYPE wml PUBLIC '-//WAPFORUM//DTD WML 1.1//EN'" +
"'http://www.wapforum.org/DTD/wml_1.1.xml'><wml><head>" +
<meta http-equiv=\"Cache-Control\" content=\"max-age=0\" /></head>" +
<card title=\"" + page_title + "\"><p>" + WML_PageContent() +
</p></card></wml>";
return page_head;
}
Much thanks for your time as this is a major concern for anyone rendering content to mobile devices, cheers Paul
jamsweb
Member
226 Points
71 Posts
Re: ASP.NET web pages or mobile forms?
Mar 19, 2007 07:37 AM|LINK
ok i had to dig out my nokia 7210 to fix this, it was 2 small errors in the WML_head(string page_title)
first there needs to be a space right after EN
"<!DOCTYPE wml PUBLIC '-//WAPFORUM//DTD WML 1.1//EN'" +
and the second problem was when i pasted the code to this forum it changed a angle bracket to: >
<card title=\"" + page_title + "\"><p>" + WML_PageContent() +
and i also chose to use double quotes in the doctype this time around so here is the new method:
private string WML_head(string page_title)
{
string page_head = "<?xml version=\"1.0\"?>" +
"<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" " +
"\"http://www.wapforum.org/DTD/wml_1.1.xml\"><wml><head>" +
"<meta http-equiv=\"Cache-Control\" content=\"max-age=0\" /></head>" +
"<card title=\"" + page_title + "\"><p>" + WML_PageContent() +
"</p></card></wml>";
return page_head;
}