NAV webpage Viewer Add-in not working

txerifftxeriff Member Posts: 501
Hi All,

I hope some1 could help. I was trying with the webpage viewer addin:
Microsoft.Dynamics.Nav.Client.WebPageViewer

however it does not show anything, see attached. Please note error page is something I wrote as a caption for it.

I was thinking it could be some issue with firewall but it does not load a gif file to a local path.
Any ideas? I had a look to service setup, but I can´t find any setup. It´s D365 on prem. by the way.

Thx!

Answers

  • txerifftxeriff Member Posts: 501
    Any1?
  • AlexDenAlexDen Member Posts: 86
    Hi,

    Are you able to display images from web?
    Provide code how you generate html to display.
  • txerifftxeriff Member Posts: 501
    edited 2020-03-03
    AlexDen wrote: »
    Hi,

    Are you able to display images from web?
    Provide code how you generate html to display.


    Hi,
    it´s as simple as this:

    WebpageViewer - OnControlAddIn(Index : Integer;Data : Text)
    CurrPage.WebpageViewer.Navigate('C:\Users\me\Desktop\Fobs\d.gif');

    WebpageViewer::ControlAddInReady(callbackUrl : Text)

    WebpageViewer::DocumentReady()

    WebpageViewer::Callback(data : Text)

    WebpageViewer::Refresh(callbackUrl : Text)
    CurrPage.WebpageViewer.Navigate('C:\Users\me\Desktop\Fobs\d.gif');


    it doesn´t work using a website neither (https://www.google.com, I´ve tried), so that´s why I tried with a gif.
  • AlexDenAlexDen Member Posts: 86
    Try to put your code into WebpageViewer::ControlAddInReady(callbackUrl : Text) trigger instead of WebpageViewer - OnControlAddIn.
  • txerifftxeriff Member Posts: 501
    AlexDen wrote: »
    Try to put your code into WebpageViewer::ControlAddInReady(callbackUrl : Text) trigger instead of WebpageViewer - OnControlAddIn.

    Thanks for that.

    Now I get : this error if I point to gif in a local windows folder:

    Insecure URL Specified.

    Please contact your system administrator.


    go

    However, I tried to a interneth path and it works fine.

    https://media.giphy.com/media/uIGfoVAK9iU1y/giphy.gif

    thanks.
  • AlexDenAlexDen Member Posts: 86
    It is restriction of WebBrowser control - it can navigate only to https urls.
    But you can prepare HTML dynamically, for example;
    CurrPage.WebpageViewer.SetContent(
      STRSUBSTNO('<img src="%1">',ImageFileName));
    

    Use it instead of Navigate.
Sign In or Register to comment.