« Happy Thanksgiving | Home | Five days left for ea… »

Webviewer Tip

If you show a website in a webviewer (Filemaker) or a htmlviewer (Real Studio), you can have a little problem. Some links in the web viewer may have target = _blank. This links now open in Safari (Mac) or Internet Explorer (Win) if the user clicks on a link. But you may not want that and prefer to keep the user inside your web viewer.
A solution is to change the target of the links by using our plugin and a little bit of javascript.

In Filemaker you can do this:
MBS("WebView.RunJavaScript"; "browser"; "for (i = 0; i < document.links.length; i++)
{ if (document.links[i].target == '_blank') document.links[i].target = ''; }")
"browser" is the name of the web viewer control on your layout. Simply run it in a calculation like a script step for setting a variable.

In Real Studio you go like this:
  dim javascript as string = "for (i = 0; i < document.links.length; i++)
 { if (document.links[i].target == '_blank') document.links[i].target = ''; }"
  
  if TargetWin32 then
    call HTMLViewer1.IERunJavaScriptMBS javascript
  elseif TargetMachO then
    call HTMLViewer1.EvaluateJavaScriptMBS javascript
  else
    break // platform not supported
  end if
As you see we call IERunJavaScriptMBS on Windows and EvaluateJavaScriptMBS on Mac. The biggest plugin in space...
25 11 11 - 18:28