Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Script not working in Safari
Old 06-15-2009, 05:29 PM Script not working in Safari
The PHP Professor

Posts: 340
Name: Alex
Location: Behind You
Trades: 0
When i use the script below it doesnt work in safari. I check the activity console and it says that the link the script tried to go to was canceled. I am stumped can anyone help?

Code:
function startupload()
{
    //detecting if a file is ready to be uploaded
    if( document.getElementById('1').value == '' )
    {
        alert('You must select at least one file to upload!');
        
        return false;
    }
    else 
    { 
        var upload_form = $('upload_form');
        
        upload_form.submit();

        initprogress();
        
        return true; 
    }
}

function initprogress()
{
    //hide some things and show some things
    var obj = $('uploadtext');
    obj.style.display = 'inline';
    var obj1 = $('uploadstatus');
    obj1.style.display = 'inline';
    var obj2 = $('uploadsystem');
    obj2.style.display = 'none';
    
    updateprogressbar();
}

function updateprogressbar()
{
    var obj1 = $('uploadstatus');
    var obj2 = $('uploadpercent');
    
    var ajax = new AjaxRequest ( 'progress.php?UPLOAD_IDENTIFIER=1234567890', {method:'get', response:'json'} );
    ajax.oncomplete = function()
    {
        var response = this.response;
        obj1.innerHTML = response.result;
        obj2.innerHTML = response.percent;
    }
    ajax.request();
    
    setTimeout ( "updateprogressbar()", 400 );    
}
The output of progress.php?UPLOAD_IDENTIFIER=1234567890 is
{"result":"Uploading","percent":"Uploading 0.22%"}
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
microcolt is offline
Reply With Quote
View Public Profile Visit microcolt's homepage!
 
 
Register now for full access!
Old 06-16-2009, 05:48 AM Re: Script not working in Safari
The PHP Professor

Posts: 340
Name: Alex
Location: Behind You
Trades: 0
Anyone, help?
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
microcolt is offline
Reply With Quote
View Public Profile Visit microcolt's homepage!
 
Old 06-16-2009, 06:45 PM Re: Script not working in Safari
vangogh's Avatar
Post Impressionist

Posts: 10,688
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
Does that mean the script works in other browsers and isn't working only in Safari?

The output you're showing us, is that what you should get or what you're actually getting back?

You might try using setInterval ( expression, interval ); in your initprogress function instead of using setTimeout in your updateprogressbar function.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 06-16-2009, 07:18 PM Re: Script not working in Safari
The PHP Professor

Posts: 340
Name: Alex
Location: Behind You
Trades: 0
Quote:
Originally Posted by vangogh View Post
Does that mean the script works in other browsers and isn't working only in Safari?

The output you're showing us, is that what you should get or what you're actually getting back?

You might try using setInterval ( expression, interval ); in your initprogress function instead of using setTimeout in your updateprogressbar function.
The script does not work in Safari and Google Chrome, which are the two browsers that use WebKit. The output is what is read by the script and then processed.
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
microcolt is offline
Reply With Quote
View Public Profile Visit microcolt's homepage!
 
Old 06-17-2009, 06:42 PM Re: Script not working in Safari
vangogh's Avatar
Post Impressionist

Posts: 10,688
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
Sounds like a webkit error then. Nothing is jumping out at me that would be a webkit only error. Are you using jquerry or prototype as your javascript library? Just a guess, but maybe it's something the library that isn't working for webkit.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 06-17-2009, 10:54 PM Re: Script not working in Safari
The PHP Professor

Posts: 340
Name: Alex
Location: Behind You
Trades: 0
I'm using prototype JS. Here's the really weird thing though, I go to upload a file and it uploads, the JavaScript stalls(like always) and there are no errors. But if i cancel the page(by pressing the X icon) it starts to work????

Talk about goofed up.
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
microcolt is offline
Reply With Quote
View Public Profile Visit microcolt's homepage!
 
Old 06-18-2009, 07:11 PM Re: Script not working in Safari
vangogh's Avatar
Post Impressionist

Posts: 10,688
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
That is weird, but it's also a clue to what's wrong. Something is holding up the script from running until you cancel it and then it can complete.

Did you ever try using setInterval instead of setTimeout?
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 06-19-2009, 06:53 AM Re: Script not working in Safari
The PHP Professor

Posts: 340
Name: Alex
Location: Behind You
Trades: 0
Yes, thank you. I did try the setInterval without any luck. I did found out something after a couple hours of toying with it.

It seems that in Safari the script only works when i put target="upload_iframe" in the form and then make an iframe with the name upload_iframe. I really dont want my content to appear in an iframe though, i want to redirect the user to the links page which is based upon the POST value so i could not simply add a redirection in the iframe to change the current page.
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
microcolt is offline
Reply With Quote
View Public Profile Visit microcolt's homepage!
 
Old 06-19-2009, 06:11 PM Re: Script not working in Safari
vangogh's Avatar
Post Impressionist

Posts: 10,688
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
I'm glad you've at least found a way to make it work, even if it's not an ideal situation. Still that seems strange WebKit would need the iframe. That's doesn't really make sense. I would think the iframe isn't necessary.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 06-20-2009, 07:31 AM Re: Script not working in Safari
The PHP Professor

Posts: 340
Name: Alex
Location: Behind You
Trades: 0
Well, you can see for your self here: http://www.clicktoupload.com/

You can use the username: test with password: test
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
microcolt is offline
Reply With Quote
View Public Profile Visit microcolt's homepage!
 
Old 06-23-2009, 12:39 AM Re: Script not working in Safari
The PHP Professor

Posts: 340
Name: Alex
Location: Behind You
Trades: 0
So should i be looking at a different Ajax Library or does anyone have a fix?
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
microcolt is offline
Reply With Quote
View Public Profile Visit microcolt's homepage!
 
Reply     « Reply to Script not working in Safari
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.32043 seconds with 12 queries