Start a new topic

MerchiumApp.setWindowHeight not working

Once the app is loaded I cant adjust the iframe height. using MerchiumApp.setWindowHeight("800px"); . I am seeing a js error in the app.js

Uncaught SyntaxError: Failed to execute 'postMessage' on 'Window': Invalid target origin '' in a call to 'postMessage'.

Error is on line window.parent.postMessage(string, M.options.shopOrigin);

Please let us know your thoughts on above.

 

Thanks for ur help.

We tried to install your app (Neowauk Events‏) in a development shop. The server where the app is hosted returns this error:
 
HTTP Status 500 - org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url.
 
Please fix this issue on your side so we could check your app.

 

Sorry about that. We had not moved the code to our Prod environment.Anyways the code is moved to Prod now and you should be able to insert the app. After installing pull up the App from installed apps section and you can see that frame height is too small.. See the screen shot below.  If you look at the 

console on chrome you can see the error on app.js Thanks for looking into this



 

As far as I can see, you haven't initialized JavaScript API, i.e. haven't called MerchiumApp.init(). API functions must be called only after the API is fully loaded; use MerchiumApp.ready() to check it.
 
Here's an example of JavaScript API initialization:
 

 

<script src='http://market.merchium.com/js/app.js'></script>
<script>
	MerchiumApp.init({
		appKey: 'APP_KEY',
		shopDomain: 'SHOP_NAME.mymerchium.com'
	});

	MerchiumApp.ready(function()
	{
		//api calls
		//MerchiumApp.setWindowHeight("800px");
	});
</script>

 

Please refer to the official documentation

Calling MerchiumApp.setWindowHeight("800px") is optional.
 
Right after JavaScript API is initialized and loaded, MerchiumApp.setWindowsHeight() will be called. The iframe height is automatically set to match its content.

 

Thanks , This is fixed now.


Login or Signup to post a comment