For anyone following along, the reason Charlie's script throws an error is 
because urlsearchparams isn't supported by IE 11:

https://caniuse.com/urlsearchparams

If you really wanted to write a complete javascript version, you would need 
to do your own string parsing based on location.search, a property that IS 
supported by IE. 

On Monday, October 26, 2020 at 3:47:28 PM UTC-7, Charlie Veniot wrote:
>
> G'day,
>
> Javascript and I have never gotten along, but once in a while I've got no 
> choice have simply must surrender to it.
>
> Working on my Chromebook, when I get something working, I never think of 
> making sure it works with other browsers.  Sure enough, I discovered today 
> that some javascript in my TiddlyWiki doesn't work with Internet Explorer.
>
> Specifically, the offending bit of code: a call to URLSearchParams.
>
> Figuring that I want error-handling that simply/gracefully/quietly exits 
> the code, I decided to wrap all of the code with "try" and "catch" 
> processing (having just discovered that today).
>
> If anybody has any related experience and/or interesting/educative info to 
> share: please please please ?
>
> Related snipit of code (from this TiddlyWiki's tiddler 
> <https://intertwingularityslicendice.neocities.org/CJ_ProductReviews.html#%24%3A%2Fmacros%2Fcharlie%2Fgetstartupcontext.js>)
>  
> further below.
>
> Cheers !
>
> exports.run = function() {
>         const queryString = window.location.search;
> try {
>         const urlParams = new URLSearchParams(queryString);
>         const wikicontext = urlParams.get('context');
>         var output = wikicontext;
>
>         if ( (output !== "OffGridding") && (output !== "HydroCutting")  && 
> (output !== "Chromebook") ){
>             output = "ProductReviews";
>         };
>           document.title = output;
> }
> catch(err) {
>             output = "ProductReviews";
> }
>         return output;
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/4a715c38-54ab-460b-adb6-7037061bd6a2o%40googlegroups.com.

Reply via email to