Select to view content in your preferred language

Close splash widget if a URL parameter is found

1510
5
Jump to solution
09-18-2020 10:11 AM
MichaelKohler
Occasional Contributor III

I have a WAB that when opened, shows a splash screen widget.

There is a custom action on popups of a feature layer that sends an email to someone using the custom url parameters. Don't want to have splash screen shown when the recipient clicks on the link.

Is there a way to close the splash widget when url parameters are detected?

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Michael,

   Sure it would just take some custom code. What parameter are you looking for in the url?

Here is an example (lines 17, 20, 24, 25, 37-39):

define(['dojo/_base/declare',
    'dojo/_base/lang',
    'dojo/_base/html',
    'dojo/on',
    'dojo/keys',
    'dojo/query',
    'dojo/cookie',
    'dijit/_WidgetsInTemplateMixin',
    'jimu/BaseWidget',
    'dojo/topic',
    'jimu/dijit/CheckBox',
    'jimu/utils',
    'esri/lang',
    'jimu/dijit/LoadingShelter',
    'dojo/Deferred',
    'jimu/dijit/EditorXssFilter',
    'esri/urlUtils'
  ],
  function(declare, lang, html, on, keys, query, cookie, _WidgetsInTemplateMixin, BaseWidget, topic,
           CheckBox, utils, esriLang, LoadingShelter, Deferred, EditorXssFilter, urlUtils) {
...
      postCreate: function() {
...
        this.urlObject = urlUtils.urlToObject(window.location.href);
        this.urlObject.query = this.urlObject.query || {};
      },

      onOpen: function() {
        if (!utils.isInConfigOrPreviewWindow()) {
          var isFirstKey = this._getCookieKey();
          var isfirst = cookie(isFirstKey);
          if (esriLang.isDefined(isfirst) && isfirst.toString() === 'false') {
            this.close();
          }
        }
        
        if(esriLang.isDefined(this.urlObject.query.closeSplash) && this.urlObject.query.closeSplash == "true"){
          this.close();
        }
...‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

View solution in original post

Tags (1)
5 Replies
RobertScheitlin__GISP
MVP Emeritus

Michael,

   Sure it would just take some custom code. What parameter are you looking for in the url?

Here is an example (lines 17, 20, 24, 25, 37-39):

define(['dojo/_base/declare',
    'dojo/_base/lang',
    'dojo/_base/html',
    'dojo/on',
    'dojo/keys',
    'dojo/query',
    'dojo/cookie',
    'dijit/_WidgetsInTemplateMixin',
    'jimu/BaseWidget',
    'dojo/topic',
    'jimu/dijit/CheckBox',
    'jimu/utils',
    'esri/lang',
    'jimu/dijit/LoadingShelter',
    'dojo/Deferred',
    'jimu/dijit/EditorXssFilter',
    'esri/urlUtils'
  ],
  function(declare, lang, html, on, keys, query, cookie, _WidgetsInTemplateMixin, BaseWidget, topic,
           CheckBox, utils, esriLang, LoadingShelter, Deferred, EditorXssFilter, urlUtils) {
...
      postCreate: function() {
...
        this.urlObject = urlUtils.urlToObject(window.location.href);
        this.urlObject.query = this.urlObject.query || {};
      },

      onOpen: function() {
        if (!utils.isInConfigOrPreviewWindow()) {
          var isFirstKey = this._getCookieKey();
          var isfirst = cookie(isFirstKey);
          if (esriLang.isDefined(isfirst) && isfirst.toString() === 'false') {
            this.close();
          }
        }
        
        if(esriLang.isDefined(this.urlObject.query.closeSplash) && this.urlObject.query.closeSplash == "true"){
          this.close();
        }
...‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
Tags (1)
MichaelKohler
Occasional Contributor III

I'm really just interested of the existence of a query parameter in the url. 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

So just change my code example above to line 36 to

if(esriLang.isDefined(this.urlObject.query.query)){

(yes two "query"s as the first query is just the object name that the browser gives to anything after the ? or & in the url).

0 Kudos
MichaelKohler
Occasional Contributor III

So I ended up doing this:

?query=cipgis_144_373,CIPNumber,UTIL-UG-2019-17&closeSplash=true

Thank you!!!

0 Kudos
ODWC_GIS
Occasional Contributor

I know it is much too late to ask for elucidations, but where exactly would this custom code go

  • Where does this code get inserted?
  • How do you access that location?
  • Is there some kind of a graphical representation that would explain to me how/where this stuff is connected/arranged?

I'm in a similar spot: I'd like the WAB's Splash Widget to not deploy when URL Parameters are present.  It would solve a major problem I've got at the moment.  ...I just don't recognize your solution. But I'd like to!

0 Kudos