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

  • SEARCH
  • Home
  • 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 4002756
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:04:07+00:00 2026-05-20T08:04:07+00:00

I’m currently have some issue with an iframe… I have my iframe with a

  • 0

I’m currently have some issue with an iframe…

I have my iframe with a searchbox and i want to make this searchbox redirection when i click on go by creating a new tab/window

http://img51.imageshack.us/i/issuec.png/

So to be clear, my google chrome extension call as a content script : overlay.js Then this one will put at the end of the current page my “overlay.html” page.

So the problem come from that my .html is represented as a iframe and i don’t see how i can redirect from this iframe.

overlay.html

<form id="searchForm" action="#" onsubmit="searchBoxRedirection(this)" method="post">
<img id="logo" src="images/extension.png" alt="Logo"></img>
<input type="search" value="" name="searching">
<input type="submit" value="Go !" /> 
</form>

overlay.js

var overlay= {
    init: function() {
        this.injectoverlay();
        //alert('Initialisation reussie');
    },

    injectoverlay: function() {
        var body = $('body'),
            overlayURL = chrome.extension.getURL("overlay.html"),
            iframe = $('<iframe id="YouroverlayFrame" src="'+overlayURL+'">');

            body.append(iframe);
            iframe.show();

        //alert('Injection reussie');
    }
}

Tool.js

function searchBoxRedirection(form)
{
    tabs.create({url:"www.yahoo.fr"});
}

manifest.json

{   

    "background_page" : "background.html",
    "browser_action" :
    {
        "default_icon" : "images/Extension.png"
    },
    "content_scripts": 
    [ {
      "all_frames": true,
      "css": ["css/overlay.css"],
      "js": ["js/overlay.js"],
      "matches": ["http://*/*"],
      "run_at": "document_start"
    } ], 
    "permissions" : ["tabs", "unlimitedStorage", "http://*/*"], 
    "name" : "MyOverlay",
    "version" : "1.1",
    "description" : "Sindar Overlay"
}
  • 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-20T08:04:07+00:00Added an answer on May 20, 2026 at 8:04 am

    Since your using Content-Scripts you cannot call any Chrome API except a few chrome.extensions.*

    Here are some examples of what content scripts can do:

    Documentation Quote

    Find unlinked URLs in web pages and
    convert them into hyperlinks’

    • Increase the font size to make text more legible
    • Find and process microformat data in the DOM

    However, content scripts have some
    limitations. They cannot:

    • Use chrome.* APIs (except for parts of chrome.extension)
    • Use variables or functions defined by their extension’s pages
    • Use variables or functions defined by web pages or by other content
      scripts
    • Make cross-site XMLHttpRequests

    Now to do what you want, you need to goto a link, you have two choices:

    1. Use Messaging to redirect the page.
    2. Call “parent” within the iframe to do a redirect.

    Messaging approach

    Messaging is simple, all you do is send a request to the extension which will chrome.tabs.create the new page.

    contentscript.js

    chrome.extension.sendRequest({visit: "http://yahoo.fr"});
    

    background.html

    chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
      if (request.visit) {
        chrome.tabs.create({url: request.visit});
      }
      sendRepsonse({}); // Snub
    });
    

    Parent approach

    Content Script injects:

    <iframe src='iframe.html'></iframe>
    <script type="text/javascript">
       function changeURL(url) {
     document.location=url;
       }        
    </script>
    

    IFrame contains:

     <a href="javascript:parent.changeURL('http://yahoo.fr');">Change to Yahoo</a>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want use html5's new tag to play a wav file (currently only supported
I have some data like this: 1 2 3 4 5 9 2 6
this is what i have right now Drawing an RSS feed into the php,
I have just tried to save a simple *.rtf file with some websites and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a JSP page retrieving data and when single or double quotes are
I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string

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.