1

I am working on asp.net and jquery website , and when run browse the site an java script error has occurred . Visual studio debuger references that GetMainFrameUrl is undefined :

function EBNavigateComplete() 
{
    if (!GetMainFrameUrl())
    {
        navCounter++;
        if (navCounter%100==0)
        {
            o.loadEmptyTerm();
            counter = 0;
        }
    }
    else
    {
        if (o.pbNavigateComplete(GetMainFrameUrl()))
        {
            counter = 0;
        }
    }
}

is there help please???

2
  • 3
    so... is GetMainFrameUrl defined? You didn't post any code for that.. Commented Aug 24, 2010 at 14:27
  • @Fosco: perhaps (s)he wants to know how to find out? Commented Aug 24, 2010 at 14:41

3 Answers 3

1

Are you using the Conduit API? If so, do you have that script library referenced? http://www.conduit.com/Developers/HtmlAndGadget/Methods/GetMainFrameUrl.aspx http://www.conduit.com/Developers/HtmlAndGadget/Events/EBNavigateComplete.aspx

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

3 Comments

Thanks for replay but i didn't use it .
Then where'd you get the code from (I'm assuming you didn't write it otherwise you'd know where the method was)? Where is GetMainFrameUrl defined? Are you referencing that file?
@DEVMBM: sure? There aren't so many people naming their methods EBNavigateComplete... Isn't it supposed to be called as callback when navigation is completed?
0

Visual Studio debugger isn't always capable of loading all dynamically loaded scripts (but normally it does though). Is the same error occurring if you run it in, say, Firefox or Opera?

The error means that the function GetMainFrameUrl is not defined. That can happen if you misspelled the name of an existing function, or when the function is loaded only later in the chain. In the latter case, change the order of your <script> blocks to have the one with GetMainFrameUrl in it load first.

One easy way to find out whether that function is available somewhere is hitting Ctrl-Shift-F in Visual Studio, select "Entire Solution" and nothing for the file filter and search for the name of the missing function.

2 Comments

thanks for replay i already do that and couldn't find reference to previous function and couldn't determine where it is called
@DEVMBM: In that case, try to reference the Conduit API as one of your first scripts. Perhaps the script you use is an external script and you weren't aware that it was dependent on Conduit? Try it, you'll be surprised by the results :)
0

If you whant to check if the GetMainFrameUrl-function exists you cant use "if (!GetMainFrameUrl())". In this case javascript execute the function and comprare the return value. You can use "if (!GetMainFrameUrl)" but this only checks if any function, object or variable exists with this name. You should use "typeof". See exampel:

function EBNavigateComplete() 
{
    if ( typeof GetMainFrameUrl !== 'function' )
    {
        navCounter++;
        if (navCounter%100==0)
        {
            o.loadEmptyTerm();
            counter = 0;
        }
    }
    else
    {
        if (o.pbNavigateComplete(GetMainFrameUrl()))
        {
            counter = 0;
        }
    }
}

Comments

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.