I am a Web dev newbie. I have an iframe named optionFrame embedded in a page index.html. I want to invoke a javascript function draw(arg) in index.html which create a FancyTree based on the arg of draw() from frame. It works perfectly fine in Chrome but in Firefox it is showing weird behavior. If the debugger is off, the fancytree is not loaded at all and I get these errors:
TypeError: parent.draw is not a function
Use of getPreventDefault() is deprecated. Use defaultPrevented instead.
index.html
{% block content %}
<div class="container-fluid" >
<div class="row-fluid" >
<div class="col-md-12" id="options" >
<div ><iframe src="/option/" style="border:0;" width="100%" height="60px" id="options_frame"></iframe>
</div>
</div>
</div>
<div class="row-fluid" >
<div class="col-md-5" id="tree" source="ajax" > </div>
</div>
</div>
<script>
function draw(args){
//draw the FancyTree
}
</script>
<!-- For FancyTree plugin -->
<script src="//code.jquery.com/jquery-1.11.3.min.js" type="text/javascript"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.min.js" type="text/javascript"></script>
<link href= "{{ url_for('static',filename='fancytree/skin-win8/ui.fancytree.min.css') }}" rel="stylesheet" type="text/css">
<script src="{{ url_for('static',filename='fancytree/jquery.fancytree-all.min.js') }}" type="text/javascript"></script>
{% endblock %}
iframe:
<script>
parent.draw(args)
</script>
When the debugger is on, the entire tree loads properly without any error or warning. I have used all three alternatives: parent, window.parent and window.top, none seem to work on firefox. Is there is a workaround for this?
I tried to tweak the code a bit more and saw that the parent reference is available but somehow the function is not available to Firefox. Can anyone tell me a solution?