Hello,

We recently started using the Wonder Ajax framework (which is amazing btw, well done guys), but we want to be able to detect if javaScript is enabled on the client's browser.

I suspect this is a problem solved by many before, but I cannot seem to find a reliable solution.

I have considered setting cookies using client-side javascript, then checking for them server-side.
But conditions can arise where this might not work.

Checking client-side should be the simplest and more reliable way, but I have hit a little problem.
The <noscript> condition is simple (no issues there)
The <script> condition is less simple. You have to use a document.write('..');
The problem is now an escaping issue (as demonstrated below):

TheComponent.html
---------------------------
<noscript>
  <webobject name = ClickedRemoveFromOrder> Remove </webobject>
</noscript>

<script type="text/javascript">
document.write('<wo:AjaxUpdateLink action = "$clickedRemoveFromOrder" title = "Remove from basket" class = "remove" updateContainerID = "$mediaItem.pk.toString"> Remove </ wo:AjaxUpdateLink>');
</script>

---------------------------
Generates:
---------------------------
<noscript>
<a class="remove" title="Remove from basket" href="/cgi-bin/ WebObjects/Shop.woa/wo/3.0.17.10.0.0.1.3.11.1.1.1.1.3.1.5.1.3.1"> Remove </a>
</noscript>

<script type="text/javascript">
document.write('<a href="javascript:void(0);" onclick="AUL.update ('246', {}, '3.0.17.10.0.0.1.3.11.1.1.1.1.3.1.5.1.3.3');" title="Remove from basket" class="remove"> Remove </a>');
</script>
---------------------------

I believe I need to escape the following characters so that they can be inserted into the document.write as a parameter.
' /
and probably a few more?

Is there a container I can use that will escape the generated HTML automatically?
Or maybe an additional binding on AjaxUpdateLink (escapeForJavascript)?

Other suggestions welcome.

Thanks in advance,

Mark



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to