Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6854297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:36:57+00:00 2026-05-27T01:36:57+00:00

I am developing a chrome extension when user clicked on the browser action button,

  • 0

I am developing a chrome extension when user clicked on the browser action button, a new tab should have to open there the screen should be splitted using frames. Inside the frames i have text box as well as iframe. The text box will acts like url bar, when the user enters the url in text box, i will update the content of iframe.

Here comes my actual problem, when the user clicks on any link inside the iframe, i have to update the url bar, but i can’t able to add event listener for the links that are inside the iframe, the problem is i can’t able to access the element inside the iframe, i am getting error as “Unsafe javascript attempt to access URL …… from the frame ….”.

This page is chrome extension tab, if it is other page, i could inject content script to add event listener inside frame, so i can’t use the content script here.

Things that i tried but didn’t work:
i) In manifest.json i added permission as “permissions”: [
“tabs”,
“http:///“,
“https:///”
]
but didn’t work.
ii) tried –allow-file-access-from-files in chrome browser but didn’t work

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:36:58+00:00Added an answer on May 27, 2026 at 1:36 am

    You don’t need to inject scripts into html files inside the extension. From those, you’ll be able to access the chrome.* API from page scripts.

    That being said, if the iframe and the frame with the textbox are in different domains, you cannot access one from the other, since cross-site scripting security prevents it.

    I’d need to see more of the HTML file you already have, but you might be able to do something like this…

    In the extension tab (that contains the text box):

    chrome.extension.onRequest.addListener(function (response) {
       if (response.type === "urlUpdate") {
          document.getElementById("addressBar").value = response.url;
       }
    });
    

    In the background page:

    chrome.extension.onRequest.addListener(function(request, sender) {
       if (request.type === "urlUpdate") {
          chrome.tabs.sendRequest(sender.tab.id, {type: "urlUpdate", url: request.url});
       }
    });
    

    Finally, a content script to be run on http://* and https://*. Make sure that you have this in your manifest (add it to an existing list of content scripts):

    "content_scripts": [
       {
          "matches": ["http://*/*", "https://*/*"],
          "js": ["address.js"],
          "all_frames": true
       }
     ];
    

    It is important that you have the all_frames set to true to get the script to run inside the iframe.

    Then, you’d have this in address.js:

    if (window.top !== window) {
       chrome.extension.sendRequest({type: "urlUpdate", url: location.href});
    }
    

    Basically, the window.top check should avoid confusion by only sending the url update message from inside iframes. You might need more filtering to keep it from running on other pages you don’t want it to.

    This is untested, but I’m fairly confident that this kind of solution would work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a Google Chrome extension. When a popup is clicked, I would
I'm developing an extension in Chrome 4 (currently 4.0.249.0) that will show the user's
I'm developing an extension for Google Chrome browser. I could not figure out how
I'm developing a Chrome extension and I'm wondering is there a way that I
I'm developing an extension in Chrome, and there's a problem. In my inject.js ,
I am developing a Google chrome extension where user uploads a file manually. I
When developing a new web based application which version of html should you aim
I'm developing a Chrome extension for a client which want me to embed a
I'm developing a Chrome extension that ships jQuery and jquery is referenced from the
I am developing a Google Chrome extension, and need to use the chrome.experimental.webRequest API.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.