Close splash widget if a URL parameter is found

873
4
Jump to solution
09-18-2020 10:11 AM
MichaelKohler
Occasional Contributor

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 Esteemed Contributor

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

4 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

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();
        }
...‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
MichaelKohler
Occasional Contributor

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

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

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

So I ended up doing this:

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

Thank you!!!

0 Kudos