Visual Builder

Get Involved. Join the Conversation.

Topic

    Shakila Murugan
    How to get browser URL in VBCS
    Topic posted August 5, 2019 by Shakila MuruganBronze Medal: 1,250+ Points, tagged Custom Code, JET, SaaS Integration, Services, Web 
    69 Views, 7 Comments
    Title:
    How to get browser URL in VBCS
    Content:

    Hi Team,

    I want to get browser URL when i  integrate my application in fusion, i attached one image file for your reference.

    i m using below code

    const urlParams = new URLSearchParams(window.location.href);

    it worked on normal javascript page but in vbcs its getting error like URLSearchParams is not defined

    Regards,

    Shakila 

     

    Version:
    19.1.3
    Image:

    Comment

     

    • John Ceccarelli

      Why do you need to fetch the URL programatically to embed in fusion?

    • Shakila Murugan

      Hi John

      I need to get username and password of the member who login in fusion.

      That particular users details i need to fetch and have to show that in my application page.

      Thanks 

      Shakila Murugan

       

    • Shay Shmeltzer

      This works for me fine in VB in the JS of a page:

      PageModule.prototype.boo = function(){
        var url = new URLSearchParams(window.location.href);
        console.log(url.has("query"));
      }

      (While the URLSearchParams shows up with a red squiggly line, it works find when you run the page).

      • Shakila Murugan

        Thanks Shay.

        Its working fine but i get only application url , can't get Request Url. 

        How can i get that URL.

        Thanks,

        Shakila

         

         

        • Shay Shmeltzer

          I'm not sure I understand the difference between application URL and request URL in your use case.

          For parameters that you pass on the URL you can just create variables in VB and mark them as input params with pass on URL - and then you'll be able to directly access them.

          Are you saying that you are passing the user and pass as parameters on the URL to your VB app?

          That's not a secure way of doing this - you should be setting single-sign-on between your VB and SaaS.

           

          • Shakila Murugan

            Thanks for response.

            We are not passing the user and pass as parameters on the URL to our VB app.

            Loggedin user detail will be generated as token url.

            In my case token and application url both will be binded, using jwt key we will split that url's.

            Please refer previous image. 

            Application URL--> https://blomvbcstest-blomsaas.builder.ocp.oraclecloud.com/ic/builder/rt/blomBanlAppLocalBO/live/webApps/blombankapp/

            Request URL--->https://blomvbcstest-blomsaas.builder.ocp.oraclecloud.com/ic/builder/rt/blomBanlAppLocalBO/live/webApps/blombankapp/?jwt=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsIng1dCI6IlpYaUpPVGlrOHIybnpRdS14TFZ0cGV3SUdpRSIsImtpZCI6InRydXN0c2VydmljZSJ9.eyJleHAiOjE1NjQ3NTIyODIsInN1YiI6IkludGVncmF0aW9uLlVzZXIiLCJpc3MiOiJ3d3cub3JhY2xlLmNvbSIsInBybiI6IkludGVncmF0aW9uLlVzZXIiLCJpYXQiOjE1NjQ3Mzc4ODJ9.NuADVHi9cZ7XAY9y-63N1Dv9wQzRGMXgg7Odg5AFAJcF9LKO54KjDc4GQpB20agVlPbo8Zh8m-ByE4qzAWjHDEdZ0quVSpRYxhZErJQvTuWj4nNEDXfZzcCVMAEIwHo0JoG9_62NtLtkGOnht6xjn_tBK6hEE98KA5mlvy0TK0LtQSLaVl33l_n9YtI2w_Fpxe8oW95f5hKZ-30XSi7sE9ulcYYmhFeNjQL9hsycnCvlS6CzWbP89a5UQBAR_KJeJK3LUNQD6VwVbB5r_Z8MHikRSTAgYBnp6TSHjA1TjHtwMy6jT44ZzOXa8--Dmr3PmC_03RUDUcdPQuSKMW-qxg

            Thanks