Announcement

Collapse
No announcement yet.

Scrolling HTML Screen: using default web browser

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scrolling HTML Screen: using default web browser

    I'm using the Scrolling HTML Screen in making a pop up from TrueUpdate, and it works great to display a page within the screen, but the issue I'm having is that any links within this page end up opening in Internet Explorer as opposed to the user's default browser.

    I'd like the links to open in a new browser using either the default browser or the already opened browser - is either of these possible? I think the problem might be that it is already opening the page in the screen using IE, so any links from this will also be redirected via IE. Is this something I could change in the "Actions" tab of the Screen Properties?

    Here is an example to try out in the preview for the screen if you put it in 'Specify now' section:
    Code:
    <html>
    <a href= "#" onclick="window.open('http://www.google.com', '_system');">Test</a>
    </html>
    Any advice would be appreciated!

  • #2
    You certainly can use the default browser to open links. To do so, instead of using Javascript in the Scrolling HTML, use anchors, like this:

    Code:
    This is a <a href="#indigo">sample link</a>
    Then, in the On Ctrl Message event script of the screen, you look for the MSGID_ONNAVIGATE message, and the URL field of the e_Details event variable. Once you detected the click on the anchor, use File.OpenURL() to open the default browser with the desired page.

    Ulrich

    Comment


    • #3
      Ok, I've tried this out, but I'm not sure.. it is still opening in IE. Here is what I put in the On Ctrl Message area:
      Code:
      if (e_CtrlID == CTRL_SCROLLTEXT_BODY and e_MsgID == MSGID_ONNAVIGATE) then
      	Shell.Execute(e_Details.URL, "open", "", "", SW_SHOWNORMAL);
      	File.OpenURL(e_Details.URL, SW_SHOWNORMAL);
      end
      Both Shell.Execute and File.Open open the link in IE. Is there something I'm missing?

      Comment


      • #4
        If File.OpenURL() is using Internet Explorer, then Internet Explorer is currently set as the default browser on the system.
        On my computer, Chrome is used to open the links, so the action is working as expected.

        Also, if you followed my instructions, e_Details.URL contains the anchor, and cannot be used directly to open the web page. If you are still using a URL as the link, then this link will be opened by the Scrolling Text control, instead of using the code in the script.

        Sample project

        Ulrich

        Comment


        • #5
          Ok, I've got it working now. My apologies, I didn't realize I will have to be specifying the URL in the On Ctrl Message section. Thanks a lot for your help!

          Comment


          • #6
            I'm back... I recall this working for me before, but now when I use the method above, which does work to open the link in the default browser, the page also gets displayed in the dialog's window as well. Any thoughts on how I can just have On Ctrl Message do the work (knowing that a URL was clicked), and not have the page redirect in the window also? Basically, I just want the links from the screen dialog to open in a new browser and keep the screen as is.

            Thanks in advance.

            Comment


            • #7
              Please take the time to study the sample I provided. If you are opening a link in the Scrolling Text control, you are not using anchors like I told you since my first message.

              Ulrich

              Comment


              • #8
                Yes, I have things set up the same way - I am using an anchor just as you suggested, and handling it in On Ctrl Message. In the HTML, I have link like this: <a href="#test">Test</a>. Then in On Ctrl Message, I do the same thing and find the anchor and use File.OpenURL() specifying the actual link there. When I click on this link "Test" in the screen, two things happen:
                1. The screen HTML changes to: "blank#test" <- bad
                2. A page opens in my default browser with the link specified when searching for the #test anchor <- good

                I would like it if #1 did not happen - I'd like to keep my HTML screen as is. Maybe I'm not communicating correctly, but the ultimate goal here is to be able to just launch links from the Scrolling Text control, not have them open in the actual dialog window. Before I tried this anchor/OnCtrlMesssage scenario, I was doing this with just adding target="_blank" to the link, but that wouldn't open in the default browser.

                I appreciate your patience and would welcome any suggestions.

                Comment


                • #9
                  Do you see this issue in the TrueUpdate executable I posted, which was built from the sample project?

                  Ulrich

                  Comment


                  • #10
                    Yes, when I use your example, I see "blank#indigo" appear in the "Your Product Update" dialog after clicking the link.

                    Comment


                    • #11
                      Well, this is new - I never saw this, and can't reproduce it on any VM here. You might be able to "reset" the contents of the Scrolling Text control with DlgStaticText.SetProperties() right after the File.OpenURL().

                      Ulrich

                      Comment


                      • #12
                        Code:
                        function OnCtrlMessage(ctrlID, msgID, details)
                        -- https://forums.indigorose.com/forum/setup-factory-9-5/setup-factory-9-discussion/304895-hyperlink-in-the-license-agreement-screen
                        -- If you provide normal url link - it will be opened in Setup factory control, which most probably uses internet explorer (old) web browser
                        -- If you provide link as #location - then web browser tries to jump to that link in local document, and since #location is not available -
                        -- it will do nothing. We however can react here on that web click.
                        
                        -- When adding html with url link, just add '#' before link itself. for example:
                        -- <a href="https://www.google.com"> => <a href="#https://www.google.com">
                        if msgID == MSGID_ONNAVIGATE then
                        log("OnCtrlMessage - MSGID_ONNAVIGATE / " .. details.URL);
                        
                        local index = String.Find(details.URL,"#")
                        if index ~= -1 then
                        local url = String.Right(details.URL, String.Length(details.URL) - index)
                        log("Shell.Execute(" .. url .. ")");
                        Shell.Execute(url, "open", "", "", SW_SHOWNORMAL);
                        end
                        end

                        Comment

                        Working...
                        X
                        😀
                        🥰
                        🤢
                        😎
                        😡
                        👍
                        👎