Where to place client script
See original GitHub issueWhen I navigate my pages, the page is not loading to the top of the new page.
- Is there some reason the new page wouldn’t navigate to the top as default?
- Where would I send JavaScript to the client? I tried putting a
window.scrollTo(0, 50);
in theArticle
’scomponentDidMount
, but that doesn’t work for obvious reasons. Must I use theDocument
setting ofstatic.config.js
, or is there a faster, cleaner way?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Client scripts - Product Documentation | ServiceNow
Client scripts allow the system to run JavaScript on the client (web browser) when client-based events occur, such as when a form loads, ......
Read more >Client Side API - Scripting In ServiceNow - YouTube
Part-19 - ServiceNow provides client-side JavaScript APIs allowing all of you to control aspects of how ServiceNow is displayed and ...
Read more >Client Script - An Overview | Online Help - Zoho CRM
Client script is a piece of JavaScript code that runs on your web browser instead of the server, thus returning an immediate response....
Read more >Client-Server Model | Roblox Creator Documentation
Roblox executes code through client-side LocalScripts, server-side Scripts, and ModuleScripts which let you reuse code and share functionality. The following ...
Read more >Create a GlideAjax call from a client script to a script include
Even as a ServiceNow dev with 5 years of experience I will find myself looking up GlideAjax syntax when I have to write...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
To wrap this up for posterity, client scripts (like google analytics, fonts, or any other assets that are site wide or external) can be placed in your
Document
component in your static.config.js file. For inline scripts, you will need todangerouslySetInnerHtml
.Being able to have
window
work incomponentDidMount
made me smile. 😃