webbrowser has stopped displaying web page - javascript

i need your help.
I use webbrowser in my delphi applications for displaying map.
For unknown reason it has stopped working in all my apps from yestarday.
All my application were working without issues for years.
Example code in delphi:
WebBrowser1.silent := true;
WebBrowser1.Navigate('c:\temp\test.html');
Example content of test.html:
<!doctype html>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<html>
<head>
<script src="https://api.mapy.cz/loader.js"></script>
<script>Loader.load()</script>
</head>
<body style="margin: 0px;">
<div id="mapa" style="width:1900px; height:1160px;"></div>
<script type="text/javascript">
var stred = SMap.Coords.fromJTSK(1077766.44,675681.75);
var mapa = new SMap(JAK.gel("mapa"), stred, 19);
mapa.addDefaultLayer(SMap.DEF_BASE).enable();
</script>
</body>
</html>
I have tried start my delphi apps on different computers with same result - it does not work on any computer, test web page is not displayed.
I have tried create new test application in Delphi 10.4 CE and in Turbo Delphi 2006 too, in both cases same result - test.html is not displayed in webbroser at all. I can open another web pages in webbrowser for example google.cz.
So it seems to me issue may be with test.html content, but same html file is possible to open in browsers like MS Edge, Opera etc. from same computer without any issues...
Now i'm little lost, because I'm not big expert I would appreciate advise how I can solve this issue.
Thanks

The reason why the mentioned map is no longer showing in TWebBrowser is the fact that TWebBrowser is just a wrapper for Internet Explorer. And since with the last update to the map software support for Internet Explorer 11 (latest version of IE available) has been dropped it means that TWebBrowser is no longer capable of showing the said map properly.
You can read more in Map API change-log here
So I'm afraid you will have to replace the TWebBrowser component in your applications either with TEdgeBrowser which is available from Delphi 10.4 or newer or make use of CEF4Delphi which is an open sourced Delphi component for chromium based browser.
You can read more about TEdgeBrowser and how to set it up in Delphi documentation

Related

Swedish charactors not displaying correclty in Safari browser

I am working on a react project which supports the Swedish language as well.
When I open the web app in the Chrome browse.
This is the expected behavior and this is correct.
But then I open the same link in the Safari web browser.
The top two dots for the letter a are not placed correctly.
index.html file contains this line also
<meta charset="utf-8" />
How do I fix this error?
Any help thanks in advance.

you are using a browser that is not supported by the google maps javascript api

I have .net windows web browser control, which loads the Google map
Recently it started to show "you are using a browser that is not supported by the google maps javascript api". I pin pointed that by default it is loaded on IE 7. Then I controlled it by adding
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
Then made sure that it loads on IE 11 with the help of custom javascript function. But still it shows the message.
Note: This message is not appeared when map is loaded on stand alone browser with above tag.
Some one an idea why or what I should change? Control it by registry is not an option.
Remove directly with CSS.
.infomsg {
display:none;
}

window.close not closing window in HTA application

In my HTA application I'm using a JavaScript calendar window, it opens using window.open() and closed using window.close(), when the user clicks on one of the dates. This calendar works fine on multiple browsers and versions over more than 10 years. It even works in HTA applications most of the time.
However on specific workstations running IE11. The window.close() command is simply ignored, resulting in the window left open. On other IE11 workstations it works fine. I figured that turning off the "Enable Protected Mode" checkbox on IE11, Internet Options, Security tab resolves the problem on one of the problematic workstation. However, other workstations works fine with this setting turned on and turning off this setting is not an acceptable solution.
Code sample which reproduces the problem:
HTA application
<HTML>
<HEAD>
<HTA:APPLICATION ID="OpenCloseExample" BORDER="thick" BORDERSTYLE="complex"/>
<TITLE>Open Close HTA container</TITLE>
</HEAD>
<iframe width="1024px" height="768px" src="http://localhost:28080/openclose.html"/>
</HTML>
openclose.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Main Page</title>
<script src="openclose.js"></script>
</head>
<body>
open
</body>
</html>
openclose.js
var win;
function openWindow() {
win = window.open("", "_blank", 'width=250,height=250,status=no,resizable=no,location=no,top=100,left=100');
win.document.writeln("<html><head><script src='openclose.js'></script></head><a href='#' onclick='javascript:window.opener.closeWindow()'>close</a></html>");
}
function closeWindow() {
win.window.close();
}
I can't see this working in any IE with any settings. The problem is this string: <script src='openclose.js'></script>. That is, a literal ending script tag in a string works as an ending script tag on a page, when HTML parser will find it. This means, that your script was never loaded.
To fix this, you've to break the literal tag, for example like so:
<script src='openclose.js'><\/script>
Since you have pointed out that IE11 is causing the JS not to work, you can force IE to render in an older version very easily.
<meta http-equiv="X-UA-Compatible" content="IE=9">
This meta tag is very popular amongst HTA applications for utilizing JS/ActiveX methods/properties within specific IE versions (most of them being deprecated).
For more information, visit the X-UA-Compatible Tag Wiki
Hope this helps
I figured this out eventually.
Changing:
open
to:
open
Has resolved the problem

Is there some default popup for appstore download on itunes when webapp is viewed in mobile safari?

I've seen the same popup across multiple websites when viewing a site in safari on iphone. For example viewing wunderlist.com and vsco.co yield the same popup when viewed on iphone on safari prompting the user to download the app. Is this something baked into safari or is this a plugin? Maybe they are built from scratch but it seems like several sites are using the same popup....
Yes, there is and it's based on a meta tag.
<meta name="apple-itunes-app" content="app-id=myAppStoreID">
You can also provide other (optional) parameters for example to generate better links for the already installed application (you can link to specific content inside the app):
<meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL">
See more information here:
https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/PromotingAppswithAppBanners/PromotingAppswithAppBanners.html

How to tell if webpage is running in chrome application shortcut mode

We can create application shortcut in google Chrome.
I would like to display a different layout when my web page is running in application shortcut mode - which basically is running in a separate standalone window.
Is there a way to tell if web page is running in application shortcut mode?
Right now I am testing if the window can be re-sized by JavaScript - assuming that it is running in application shortcut mode if the window can be re-sized.
I am wondering if there is a better way to do this.
[Update]
Basically we want to know if the webpage is running in a single window or running in one tab of a window.
I've just googled a bit and found this site: http://blog.kenneth.io/blog/2010/05/04/desktop-icons-in-google-chrome/
You can see this <meta> element in the first code block:
<meta name="application-url" content="http://www.example.com"/>
I haven't found any reliable and offcial documentation* yet, but it seems to work in a quick test I've just made.
In that way, you could pass an extra query string to your URI which only gets called when opening from a pinned (taskbar|desktop) short cut.
*) This <meta> element is also unofficially metioned here: Page Meta Properties - mozilla f1.
How can it be used?
Create a new HTML document:
<html>
<head>
<meta charset="utf-8" />
<meta name="application-url" content="http://www.exaple.com?shortcut=true" />
<title>Test</title>
</head>
<body>
Test
</body>
</html>
Now, open this document in Google chrome (works also with local file system!).
Create a taskbar and/or desktop shortcut via Chrome's Tools menu.
Chrome will open another window with the original URI. This is possibly a bug.
But if you use the shortcut, Chrome will open the URI provided in the <meta> tag (here: http://www.exaple.com?shortcut=true).

Categories

Resources