Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Service Portal Error: There is a JavaScript error in your browser console

Allison3
Kilo Guru

We just moved our servicenow instance to fedramp. We are now getting the same error on an portal page: There is a JavaScript error in your browser console.

 

I've looked at the code and I think this is the error that's cause it to show up: <meta name="apple-mobile-web-app-capable" content="yes"> is deprecated. Please include <meta name="mobile-web-app-capable" content="yes">

 

But when I look in client scripts I'm not finding this anywhere. Has anyone seen this before?

2 REPLIES 2

MikeWoolsey
Tera Contributor

Since I'm new to this too, I'm going to suggest investigating something.

 

(And ... even if you do fix this setting, I'm kind of skeptical it is responsible for causing errors in the Javascript being performed. This message seems like it's saying, "you set this meta tag, but it no longer means anything for execution.")

 

I googled with the following string and Google Gemini responded with some instructions that I was actually looking for, to see if this were the issue with the meta tag. Again, I'm not an experienced developer. I just ran across this as one thing you might investigate.

 

What I googled:

   servicenow configuration settings "apple-mobile-web-app-capable"

 

What Google replied was essentially how to set up such a metatag:

For a Specific Service Portal Page
  1. Navigate to Service Portal > Pages.
  2. Open the desired page record.
  3. Click the Meta tags related list tab.
 
I'm wondering: is there a meta tag declared for your Service Portal?
 
If it is there, I'd say remove the "apple-" prefix from the special configuration.
 
However, if you didn't have iPhone settings specially selected, Google also pointed out, this is a general setting inside the theme. There, if you've customized the theme or cloned it, you may need to rummage through the theme meta settings and rename (to "mobile-web-app-capable" if it doesn't exist yet) or remove the "apple-mobile-web-app-capable" setting from the theme or clone of the theme.
For the Entire Service Portal (Theme or System Property)
While the page-level configuration is the standard approach, the platform also generally includes this meta tag by default in the base Service Portal template for optimal mobile display. 
  • Check the Portal Theme: The overarching <head sp-metatags=""> template is part of the portal's theme or layout configuration. The default configuration often already includes <meta name="apple-mobile-web-app-capable" content="yes">.
This configuration enhances the user experience, making the web portal function more like a native application when launched from an iOS home screen icon. 

 

MikeWoolsey
Tera Contributor

If you fix the meta tag and it doesn't help you, I didn't want to leave you hanging as to "what next?"

 

Looking over your log image, I notice there's another error: something about "getMessage(...): synchronous use is not supported for ... Service Portal use." I am much, much more expecting this to be the real reason Javascript isn't executing. The log entry is saying , "[Wait, this function call] is not supported ..." The server has to cancel this Javascript, since it doesn't know what you're trying to do with this function call.

 

If you can locate this "getMessage()" call, a quick trial would be to see if the script crashes into an error in the code after this call -- maybe comment out the // getMessage() call, and see if you can get to the next line of Javascript?

 

This is dicey to remember you've done it, so for me, I always add "/\/\" at the end of the line so I can make a quick search of the code to see if I've done something by way of debugging.