0

I am using window.showModalDialog in current apps. How can change title based on upon some conditions in javascript? Can anybody help on this. Please don't consider duplicate post. I tried different ways to change title:

  1. window.document.title="Add Cartons"

  2. var results=window.showModelDialog(url,"Add Cartons",windowarguments)

But I can't successes.

Please help on this.

2
  • What's the browser that you are using? If you are using IE, there's a BUG with it. support.microsoft.com/kb/263033 Commented Dec 23, 2013 at 12:55
  • Yes I am using IE7 & 8 Browser Commented Dec 25, 2013 at 4:29

4 Answers 4

1

Try this:

       window.document.title = "yourtitle";
        if (window.dialogArguments) {
            window.opener = window.dialogArguments;
        }
        function setTitle() {
            document.title = "NewTitle";
            alert(document.title)

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

Comments

1

You can pass a new title via dialog arguments argument, just like you've tried:

var results = window.showModalDialog(url, 'Add Cartons', windowarguments);

And then in a script in the dialog:

document.title = window.dialogArguments;

Though looks like they haven't fixed the showModalDialog() in Chrome yet. So this is not going to work in Chrome.

Comments

0

Microsoft has a detailed solution over this problem. Please refer to

support.microsoft.com/kb/263033

Comments

-1

You need to change the title of the window you're calling (the popup), not the one from which you're calling the popup. So, put <title>Add Cartons</title> inside the head of your popup and it will show up.

To modify it based on the popup call, use the arguments, read them from the popup and dynamically change the title.

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.