0

We want to show a warning message for an unsupported browser to the user. Our system is developed into salesforce classic and wants to show an alert or simple warning message once when user logged in our system.

I want to write a script which will run globally (for every vf page), detects which browser user using & accordingly it will display a message only once when user login. I did not understand what approach should we use, where to write javascript for alert messages.

I searched online but did not found any solution.

3
  • 4
    consider customized login flow to intercept in one place
    – cropredy
    Dec 31, 2019 at 6:17
  • 1
    @cropredy You should have added that as an answer?
    – sfdcfox
    Dec 31, 2019 at 6:20
  • Thanks @cropredy, this solution working as expected. sfdcfox yes it should be added as an answer. Dec 31, 2019 at 7:45

2 Answers 2

0

The best way to do this is is not on every VF page, but rather by using a customized login flow to detect the user's browser at point of entry to Salesforce.

Use Visualforce and an Apex controller to create a custom login flow programmatically. With Visualforce, you have complete control over how your login page looks, behaves, and where users go after they complete the flow. You can design your login page from scratch and control every pixel of the page.

You can also do this declaratively using a Flow as shown in this example. The flow has access to the user agent in LoginFlow_UserAgent

3
  • This works as expected, but for user license "customer portal", "login flow" page not displaying & it redirecting to home page. I already added login flow for "portal user" profile. For other profile (user license "salesforce platform") its working properly. What I am missing ? Jan 3, 2020 at 11:34
  • best to ask this as a separate question on SFSE
    – cropredy
    Jan 3, 2020 at 16:39
  • Okay. I added new question Jan 6, 2020 at 10:31
0

You can have script in the visualforce page which runs on page load where you can check the browser

<script> 
var previousOnload = window.onload; 
window.onload = function() {

    var objbrowserName  = navigator.appName;
    //logic 
    console.log('====objbrowserName===',objbrowserName);
 }
 </script>

this works respective to the page.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .