0

I am trying to run this code from this thread in Stack Overflow in Oracle ApeX and it looks as if the setTimeout call is not working as suppose to:

[see thread][1]

<html lang="en">
<head>
<title>Dashboard Example</title>
<style type="text/css">
body, html { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; }
iframe { border: none; }
</style>
<script type="text/javascript">
var Dash = {
    nextIndex: 0,

    dashboards: [
        {url: "http://www.google.com", time: 5},
        {url: "http://www.yahoo.com", time: 10},
        {url: "http://www.stackoverflow.com", time: 15}
    ],

    display: function()
    {
        var dashboard = Dash.dashboards[Dash.nextIndex];
        frames["displayArea"].location.href = dashboard.url;
        Dash.nextIndex = (Dash.nextIndex + 1) % Dash.dashboards.length;
        setTimeout(Dash.display, dashboard.time * 1000);
    }
};

window.onload = Dash.display;
</script>
</head>
<body>
<iframe name="displayArea" width="100%" height="100%"></iframe>
</body>
</html>

How can I get this call to work in Oracle ApEx v3.0.1?

1 Answer 1

0

This problem is nothing to do with Apex - in fact you can take the HTML you posted, save it to a file, and run that file in a browser to test it.

Unfortunately, www.google.com is a URL that will not work with this code, because it contains some "framebusting" Javascript of its own that pops it out of the frame into the browser window, after which your code is no longer running. stackoverflow.com does something similar. If you change the first URL to www.bbc.com for example then it works (on IE anyway) until it gets to stakoverflow.com, when it pops out of the frame.

Sign up to request clarification or add additional context in comments.

4 Comments

Understand that it works fine in IE6 but just to let you know that instead of using frames, I actually changes the code to reference an iframe src using document.getElementById("iframe").src = dashboard.url I think the issue is with the setTimeout call in Apex. As a test Tony, create a dummy function in the above code that alerts a message and call that function using the setTimeout("yourFunction();",5000) and hopefully you'll see that it won't work. Pls let us know - thanks.
Furthermore, I am using my intranet URLs and not referencing google.com or stackoverflow urls in my code.
OK, I don't have Apex 3.0 but tested it with Apex 4.0 at apex.oracle.com and it works fine: apex.oracle.com/pls/otn/f?p=37742:1
Sorry, I should say it worked fine once I added an ID of "displayArea" to the frame.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.