PDA

View Full Version : AjaxTabContent Help!



vnguyen972
02-11-2007, 04:26 AM
1) Script Title: AjaxTabs Content

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/

3) Describe problem: I downloaded the demo and tried to run it but always get this error:

Line: 41
Char: 1
Error: Access is denied.
Code: 0
URL: http://localhost:8080/ajaxTabs/demo.htm

What does that mean? i'm runninng IE 7.0.5730.11

Thanks

jscheuer1
02-11-2007, 04:47 AM
That's odd, I don't get that error but, the script doesn't work for me locally in IE 7. It just switches to the external page. However, what you are experiencing may be due to the same cause described below. Did you change anything?

Unless you are trying to import content from somewhere else than the same local machine where you are using the script or your imported content is invalid, that is due to improvements in IE 7 and, will happen locally. If you have FF or Opera, they will not do that. Once the page is live, IE 7 will be just fine.

If you do not have either of those two browsers to use in testing locally, you should but, that is another story. You can temporarily disable the error by editing ajaxtabs.js like so (near the top):


function ajaxpage(url, containerid, targetobj){
var page_request = false
/*if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else*/ if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new Act

Don't forget to return it to its original state for live use.

vnguyen972
02-11-2007, 04:54 AM
Hi there, thanks for your response.

It has the same behavior when off-line and online. No, i didn't change anything... just unzip the demo package and run it as is.

I really like the script but this is so strange that i cannot use it.

I tried your suggestion and still got the same error... it kept saying "Access is denied" on line 41. Which line 41 is that? from the ajaxtabs.js ??

Any other help would be awesome!

Thanks in advance.

jscheuer1
02-11-2007, 05:00 AM
I'd need a link to your live copy. I think it might be your browser's or computer's configuration or something that was done to the files somehow on your end. Does the demo page on DD work OK for you?

vnguyen972
02-11-2007, 05:14 AM
Okay, I put the demo up to a hosting site that i have and it works perfectly fine viewing with the exact browser so I don't think the browser is the problem.

What i have run on my local machine was Tomcat 5 on 'localhost:8080' port... what is the problem with Tomcat and this demo?

I'm pulling my hair out.

jscheuer1
02-11-2007, 05:21 AM
I don't know this Tomcat 5 on 'localhost:8080' port . . . but, it sounds like a server simulation. I have one of those and it really messes with Ajax scripts. When testing locally, why not simply test it locally? Do you really need to use Tomcat 5 on 'localhost:8080' port . . . ?

vnguyen972
02-11-2007, 05:26 AM
I kinda do. I'm working on a Java Web Application and Tomcat was chosen as an application/web server and I wanted to use this script for the page's tab menu... and so far, i couldn't.

jscheuer1
02-11-2007, 05:50 AM
Well, the error that you are getting is the error I get if I put http://www.google.com in the href attributes for one of the links. That means that Ajax thinks Tomcat 5 is external to itself unless you are truly testing the page locally while at the same time trying to access content on Tomcat 5 from it. If this is not the case, I'd check in a Tomcat 5 forum.

vnguyen972
02-11-2007, 06:02 AM
I found the issue.

It's the 8080 port. This script think it's external. If i configure my Tomcat to port 80... and run the demo without the port... it works PERFECT!

Thanks for all your help!

vnguyen972
02-11-2007, 06:54 AM
Hi, since you're an expert... can i ask you another question?

Now that I have the tab panels working... to load an external HTML page... is it possible for me on that HTML page to make a call to the script (and not from the tabbed menu) and reload another page on the same panel?

jscheuer1
02-11-2007, 10:02 AM
You can have code like this on an externally loaded page:


<ul id="maintab8" style="display:inline;list-style:none;">
<li style="display:inline;"><a href="bob.htm" onmousedown="startajaxtabs('maintab8')" rel="ajaxcontentarea">Bob</a></li>
</ul>

vnguyen972
02-11-2007, 04:46 PM
Thanks!

trentandrews
08-10-2007, 03:42 PM
There is actually a problem with this script and ports

here is the code to change


if (ulistlink.getAttribute("rel")){
var modifiedurl=ulistlink.getAttribute("href").replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname"/")

to

if (ulistlink.getAttribute("rel")){
port = window.location.port;
if (port != "80") {
port = ":" + port
}
var modifiedurl=ulistlink.getAttribute("href").replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+ port"/")