Forum Discussion
Send storyline variable to the WebObject
I am trying to either send or access storyline custom created variable into the WebObject which is embedded in storyline. I am not able to send or receive variable values either ways. Browser is throwing error stating "Failed to read a named property 'GetPlayer' from 'Window': Blocked a frame with origin "null" from accessing a cross-origin frame." Is there any ways to achieve this. Thanks in advance.
- Jürgen_Schoene_Community Member
from the webobject (= iframe) you need the command "parent.GetPlayer()"
var player = parent.GetPlayer();
// readplayer.GetVar('testVar');
// write
value = 'this is a text';
player.SetVar('testVar', value); - JigneshShah-594Community Member
Thank you for your response . I have already tried to implement the same. But as I mentioned in my earlier comment that it is throwing an error stating "Uncaught DOMException: Failed to read a named property 'GetPlayer' from 'Window': Blocked a frame with origin "null" from accessing a cross-origin frame." Is there anything else which i need to do. Thank you in advance
- Jürgen_Schoene_Community Member
you are using the version of web object (index.html)?
https://community.articulate.com/articles/storyline-360-adding-web-objects
- JigneshShah-594Community Member
yes i am using an index.html as a webobject
- Jürgen_Schoene_Community Member
here is a small example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="referrer" content="same-origin" />
<title>test</title>
<style>
</style>
<script>
var player = parent.GetPlayer();
var test1 = player.GetVar("test1");
player.SetVar("test2", test1.toLowerCase() );
</script>
</head>
</html>https://360.articulate.com/review/content/d95eefc4-c24b-40e2-8a8a-6b78f88e439b/review