Solved

Creating AJAX portlets in Oracle Portal

Posted on 2007-11-27
3
1,597 Views
Last Modified: 2013-12-18
I placed the following code inside an HTML portlet:

<html>
<head>
<script language="JavaScript" type="text/javascript">
var req

function loadURL(url)
{
req=null
if (window.XMLHttpRequest) {
req=new XMLHttpRequest()
}
else if (window.ActiveXObject) {
req=new ActiveXObject("Microsoft.XMLHTTP")
}
if (req!=null) {
req.onreadystatechange=state_Change
req.open("GET",url,true)
req.send(null)
}
else {
document.writeln("Cannot get URL status. Your browser does not support XMLHTTP.")
}
}

function state_Change(){
// if req shows "loaded"
if (req.readyState==4) {
// if OK
if (req.status==200) {
document.getElementById('A1').innerHTML="(Available)"
}
else {
document.getElementById('A1').innerHTML="(Connection Failure)"
}
}
}

</script>
</head>
<body onload="loadURL('http://www.yahoo.com')">

<p>
<b><a href="http://www.yahoo.com">Yahoo test</a> <span id="A1"></span></b>
</p>
</body>
</html>

It works fine offline, but once I put the code into an HTML portlet it doesn't work. I am not getting the security warning pop up so it doesn't look like the xmlhttp request object is being created.

Has anyone been able to get anything similar to work? If not, is there another way I can accomplish this in Portal?
0
Comment
Question by:shadowrox
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 63

Expert Comment

by:Zvonko
ID: 20368653
Are you sure you get no access permission error or do you only not see the error?
In FireFox look for the error console by entering javascript: as url or by openning menu: Extras->ErrorConsole
In IE look in lover left window corner for the yellow triangle and click on it.

The acces is forbidden because you could fake yahoo.com if your script would be allowed, you see?

0
 

Author Comment

by:shadowrox
ID: 20370137
I ran the debugger. You're right, at  req.open("GET",url,true)  I get 'permission denied'.
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 100 total points
ID: 20371788
So the answer to you question here is: what you want to do in browser is not possible when page is loaded from a web server because of security reasons. Do it on web server side scripting by PHP, ASP, Perl or what you have on web server side.

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question