Hexagon Geospatial
MENU

M.App Enterprise

Discuss topics with other M.App Enterprise Product pioneers and experts to get the most out of it.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Frequent Contributor
Posts: 145
Registered: ‎02-17-2016
Accepted Solution

How to embed a browser app into another web page/application?

Is there a way to set up a public browser app (so no login required) in M.App Enterprise and embed that into another web page?  Can the browser app and the web page interact? Thanks

Regular Contributor
Posts: 250
Registered: ‎03-10-2016

Re: How to embed a browser app into another web page/application?

Hi there!

I am trying to solve this question as @rgoodman already described some years ago.

 

As shown in this Tutorial it is easy to create "public access" to a browser app with few lines of code.

 

I am trying to embed my browser app in another webpage via iFrame, but when I insert my URL for public access the map is not loaded in the frame.

 

This is my URL:

https://dev.mappenterprise.de/PublicAccess/dev/index.html?tenant=dev

 

And this is the HTML iframe i want to use to embed the map in an existing webpage:

<!DOCTYPE html>
<html>
<body>

<h2>Iframe - Target for a Link</h2>

<iframe src="https://dev.mappenterprise.de/PublicAccess/dev/index.html?tenant=dev" height="100%" width="100%"></iframe>

<p>When the target of a link matches the name of an iframe, the link will open in the iframe.</p>

</body>
</html>

There are somme errors in console:

rest.js: The main module has moved, please switch your configuration to use 'rest/browser' as the main module for browser applications.
ncaught DOMException: Blocked a frame with origin "https://dev.mappenterprise.de" from accessing a cross-origin frame.
    at n.__negotiateCommunication (https://dev.mappenterprise.de/BrowserClient/app.f191a13e5ea90f9f.js:400:4219)
    at n.__negotiateCommunication (https://dev.mappenterprise.de/BrowserClient/app.f191a13e5ea90f9f.js:400:2739)
    at n (https://dev.mappenterprise.de/BrowserClient/app.f191a13e5ea90f9f.js:400:3513)
    at https://dev.mappenterprise.de/BrowserClient/app.f191a13e5ea90f9f.js:388:27841
    at r (https://dev.mappenterprise.de/BrowserClient/app.f191a13e5ea90f9f.js:389:11273)
    at https://dev.mappenterprise.de/BrowserClient/app.f191a13e5ea90f9f.js:387:23877
    at F (https://dev.mappenterprise.de/BrowserClient/app.f191a13e5ea90f9f.js:387:31682)
    at N (https://dev.mappenterprise.de/BrowserClient/app.f191a13e5ea90f9f.js:387:31314)
    at C.when (https://dev.mappenterprise.de/BrowserClient/app.f191a13e5ea90f9f.js:388:2909)
    at w.run (https://dev.mappenterprise.de/BrowserClient/app.f191a13e5ea90f9f.js:388:1945)
POST https://dev.mappenterprise.de/jsnlog.logger 404
r.sendLogItemsAjax @ app.f191a13e5ea90f9f.js:396
i.sendBatch @ app.f191a13e5ea90f9f.js:396
i.log @ app.f191a13e5ea90f9f.js:396
e.log @ app.f191a13e5ea90f9f.js:396
e.fatalException @ app.f191a13e5ea90f9f.js:396
window.onerror.window.onerror @ app.f191a13e5ea90f9f.js:396
error (async)
(anonymous) @ app.f191a13e5ea90f9f.js:396

 

Does somebody knows how to solve it?

 

Thanks

Stefan

GAUSS Ingenieurtechnik GmbH | Germany
Staff
Posts: 1,032
Registered: ‎10-18-2015

Re: How to embed a browser app into another web page/application?

Hi Stefan,

 

I guess the site you are loading the MAE app into is not on the MAE server. That generates CORS issues, for security reasons the browser prevents loading scripts from a different machine. The only possibility is to enable CORS at the server side if you have control of the hosting site.

 

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Regular Contributor
Posts: 250
Registered: ‎03-10-2016

Re: How to embed a browser app into another web page/application?

Hi Stefano!

 

That's it! I did a test with my configuration ON the server and it works fine!

I will also check CORS when directing from another server!

 

Thanks!

(If I could I would accept your post as solution, but I can't)

 

Result here:

testframe.PNG

GAUSS Ingenieurtechnik GmbH | Germany
Staff
Posts: 1,032
Registered: ‎10-18-2015

Re: How to embed a browser app into another web page/application?

looks good Stefan! Thanks for sharing!

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Development Ticket through our Development Ticket Portal.