2 Replies - 361 Views - Last Post: 22 July 2014 - 10:51 AM

#1 tenkepadu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 20-July 14

Put webpage title in Google Maps w/o affecting google maps searchbox

Posted 20 July 2014 - 11:03 PM

Hi, how can I put the webpage title in Google Maps site? without affecting the search box, because whatever I put a title in Google Maps, its also display in the Google Maps search box. How can I avoid that? I try to put
 document. title=""; 
in my code but its not working. Will you please help me. I really need this. Thank you.

Here's the code that opens the Google maps in new tab:

function scanLapVerification() {
    //msgbox("sendRequest: scanLapVerification");
    chrome.tabs.sendRequest(tabLapVerification, { method: "scanLapVerification" },
        function (response) {
            msgbox("receiveResponse: scanLapVerification " + jsonToString(response, "JSON"));
            // maintaining state in the background
            if (response.data.content == "address_check") {
                //open google maps with request for contact address
                var gmaps;
                if (confirm("Do you want to proceed on Google Maps and search for Contact Address?") == true) {
                    gmaps = tabCreate("http://maps.google.com/maps?q=" + encodeURIComponent(response.data.contact_address));
                } else {
                    gmaps = "You Cancel!";
                }
                document.getElementById("maps").innerText = gmaps;
            }
            document.title = "Hello World";
        }
);
    }


Is This A Good Question/Topic? 0
  • +

Replies To: Put webpage title in Google Maps w/o affecting google maps searchbox

#2 ArtificialSoldier  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 429
  • View blog
  • Posts: 1,569
  • Joined: 15-January 14

Re: Put webpage title in Google Maps w/o affecting google maps searchbox

Posted 22 July 2014 - 09:05 AM

Using document.title refers to the current page, not the new tab. I'm not familiar with Chrome's tab API and I don't know what your tabCreate function does, but if you go through the documentation you should find a way to change the title of a particular tab.
Was This Post Helpful? 0
  • +
  • -

#3 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4359
  • View blog
  • Posts: 12,179
  • Joined: 18-April 07

Re: Put webpage title in Google Maps w/o affecting google maps searchbox

Posted 22 July 2014 - 10:51 AM

Perhaps you should look up chrome.tabs.executescript which is a method you could use to inject some script into the tab. Here you could then create a script which accesses the search box through it's id and erase the contents of the search box. Think of this like going to a page and having your own custom script on their page.

Oh and btw, you may also want to look at getting away from the use of sendRequest, that is deprecated. They recommend using runtime.sendMessage now. Hope this helps! :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1