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 works in IE but not in Chrome/firefox...
Old 07-09-2010, 08:29 AM Script works in IE but not in Chrome/firefox...
Junior Talker

Posts: 1
Trades: 0
I have an external javascript running that i downloaded from the internet and used in my html page. It lets links being displayed in an iframe.

Here's the script:

Code:
/*************************************************************************
    This code is from dyn-web.com
    free for all uses as long as this notice retained
*************************************************************************/

/*  dw_loader.js      version date: July 2008
    loads url in iframe, transfers body content into div
    provides defaults for iframe and display div ID's 
    also supports use with multiple iframes and divs
    optional message for loading in display div 
    supports functions to be called once the div has been populated with new content 
    function in iframed document can be invoked should some operations need to be performed from there 
*/

function dw_loadExternal(url, ifrmId, divId, bLoadMsg) {
    // defaults for iframe, display div
    ifrmId = ifrmId || 'buffer'; divId = divId || 'display'; 
    if ( window.frames[ifrmId] ) {
        // Could use location.replace method if you do not want back button to load previous iframe url 
        //window.frames[ifrmId].location.replace(url);
        window.frames[ifrmId].location.replace(url);
        // If you want the whole page to scroll to the top when new content is loaded 
        //window.scrollTo(0,0);
        var lyr = document.getElementById? document.getElementById(divId): null;
        if ( lyr && bLoadMsg ) { // Option to display message while retrieving data 
            lyr.innerHTML = '<p>Retrieving data. Please wait ...</p>';
            lyr.style.display = 'block'; 
        }
        return false;
    } 
    return true; // other browsers follow link
}
Inside the html, this is the code i use for the iframe:
Code:
<div id="display"><p><!--webbot
    bot="HTMLMarkup" startspan --><IFRAME id="buffer" name="buffer" height="100%" frameborder="0" width="100%" src="section.htm" onload="dw_displayExternal(this.href)"><!--webbot bot="HTMLMarkup" endspan --><!--webbot
    bot="HTMLMarkup" startspan --></IFRAME><!--webbot bot="HTMLMarkup" endspan --></p>
    </div>
The code for triggering a link inside the html:

Code:
<a
    href="purchasing/Section_00rev.htm" onclick="return dw_loadExternal(this.href)">Section<strong>
    00</strong></a>
For some reason, this script works great in IE, but it doesn't work in Chrome (links don't respond at all) and in Firefox (works, but frame is veeeery tiny).

I can't figure out how to change it to make it work on IE and the others.
Can somebody help me out pls?

Thanks in advance for the efford
Nogi is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-11-2010, 07:41 AM Re: Script works in IE but not in Chrome/firefox...
Junior Talker

Posts: 1
Trades: 0
Your link cannot work if you dont specify the frame id in the parameters list of dw_loadExternal.
Curently you write
Code:
dw_loadExternal(this.href)
But you you have to write:
Code:
dw_loadExternal(this.href, buffer)
The two others parameters are not mandatory but the frameId is needed to retrieve it and to give another url to it.
owwwer is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Script works in IE but not in Chrome/firefox...
 

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.15696 seconds with 12 queries