"chrome extensions: which will be better, ajax or chrome.extension.sendrequest?" Code Answer
Answers related to “chrome extensions: which will be better, ajax or chrome.extension.sendrequest?”
- The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead
- file_get_contents(“php://input”) or $HTTP_RAW_POST_DATA, which one is better to get the body of JSON request?
- How to tell if a page is being called via Ajax, or on it's own
- Which PHP calendar will suit my needs? Or build my own?
- php - which one is better approach null== or ==null
- Dynamic select box to populate a textfield using AJAX or jQuery and PHP
- which one is faster/better strcasecmp() or equal to operator?
- Deprecated Ajax Or JQuery Command Cause No Result Returned
- How to make a POST request using AJAX in a Chrome Extension?
- To display this page, Firefox must send information that will repeat any action (such as a search or order...
- 1500 row table with each row containing a form - Ajax or something else?
- The uploaded image not displayed after ajax upload in chrome
- Submit more than one form in Javascript/ajax or jquery
- Attach JQuery Autocomplete to a text field which is loaded by Ajax call
- Loading progress in php, ajax or javascript?
- How to send data to a PHP email script with AJAX or JSON
- On Key Up vs On Change with AJAX queries: which is better?
- Make a button countdown timer which will be permanently disabled after 5 minutes even on page refresh it should...
- Updating address bar with new URL without hash or reloading the page
- Hibernate Annotations - Which is better, field or property access?
- Can you “compile” PHP code and upload a binary-ish file, which will just be run by the byte code interpreter?
- Contexts and methods for communication between the browser action, background scripts, and content scripts of...
- How can I pipe initial input into process which will then be interactive?
- Declaring a variable inside or outside an foreach loop: which is faster/better?
- Is it possible to run Google Chrome in headless mode with extensions?
- Chrome refuses to execute an AJAX script due to wrong MIME type
- How to manually send HTTP POST requests from Firefox or Chrome browser?
- In a C expression where unsigned int and signed int are present, which type will be promoted to what type?
- Unable to sign into google with selenium automation because of “This browser or app may not be secure.”
- Google Chrome Extensions - Can't load local images with CSS
- In `knitr` how can I test for if the output will be PDF or word?
- AJAX request to local file system not working in Chrome?
- Cross-Origin XMLHttpRequest in chrome extensions
- jquery ajax problem in chrome
- Why will jQuery not load in Facebook?
- Google Chrome Extensions: How to include jQuery in programmatically injected content script?
- Google Chrome Extensions - Open New Tab when clicking a toolbar icon
- Which is a better write barrier on x86: lock+addl or xchgl?
- Google Chrome - Alphanumeric hashes to identify extensions
- Is there a way to control which implicit conversion will be the default used?
- Blocking Chrome Extensions from running on my site
- Suppress warning “Category is implementing a method which will also be implemented by its primary class”
- How do you integrate Universal Analytics in to Chrome Extensions?
- Use Object.assign or Spread Operator in React/Redux? Which is a better practise
- Ajax call bug with Chrome new version 73.0.3683.75?
- Get data from html and <do some operation on it> and pass the data back to the front end using ajax or js
- jquery $.ajax call results in 401 unauthorized response when in Chrome or Firefox, but works in IE
- Where to find extensions installed folder for Google Chrome on Mac?
- Modify HTML of loaded pages using chrome extensions
- View AJAX response content in Chrome developer tools?
- Google Chrome Socket API in extensions
- How does Same Origin Policy apply to browser extensions?
- Accessing partial response using AJAX or WebSockets?
- Call Controller Method Which Return View With Ajax Call From Asp.net View Page
- Can I modify chrome://extensions/ page with JavaScript(user script)?
- How does Rust pattern matching determine if the bound variable will be a reference or a value?
- what is the difference between ajax and jquery and which one is better? [closed]
- Which framework is better CXF or Spring-WS? [closed]
- Is it possible to develop Google Chrome extensions using node.js?
- How to modify current url location in chrome via extensions
- How to get focus to a Chrome tab which created desktop notification?
- How to call functions in the original page(tab) in Chrome Extensions
- Chrome extensions : How to know when a tab has finished loading, from the background page
- How to check if request is ajax or not in codebehind - ASP.NET Webforms
- Running Selenium WebDriver using Python with extensions (.crx files)
- Promise support for Chrome Extensions API?
- How to test chrome extensions?
- Google Chrome Extensions and NPAPI
- In C# would it be better to use Queue.Synchronized or lock() for thread safety?
- Do Chrome extensions access iframes?
- What will be the order in which filters will be called?
- How to priorly get future Glide image size which will be stored in cache in Android/Java?
- Which is better, implicit or explicit join?
- Which is better: PooledConnectionFactory or CachingConnectionFactory?
- Chrome extensions for silent print?
- How do I change my IIS Express SSL certificate for one that will work with Chrome 58+?
- How to create dialog which will be full in horizontal dimension
- How to Use SHA1 or MD5 in C#?(Which One is Better in Performance and Security for Authentication)
- Which one is better, InProc or SQL Server, for Session State mode in asp.net?
- Which one have better performance : Derived Tables or Temporary Tables
- What are Chrome apps vs plugins vs extensions and how to develop them
- Chrome extension that runs code when ajax requests happen
- Chrome: Will an error in code invoked from the dev console trigger window.onerror?
- Will Chrome and other browsers drop support for Synchronous XMLHttpRequest?
- How can I change the device on which OpenCL-code will be executed with Umat in OpenCV?
- JavaScript: Which should I use, Microsoft.XMLHTTP or Msxml2.XMLHTTP?
- Chrome Extension which is supposed to run on all Facebook pages only runs when I hit refresh
- Apps must follow the iOS Data Storage Guidelines or they will be rejected in app that contains .sqlite3
- Which would be better non-greedy regex or negated character class?
- Where can I see which chrome extensions API is valid for which chrome version
- xml, html or xhtml in <xsl:output>: Which is the better choice?
- cookie or localStorage with chrome extensions
- Find out which line will be executed in Visual Studio debug mode
- TypeScript for initial data can use interface type or class type Which way is better?
- Difference between Chrome Apps and Extensions
- Does mobile Google Chrome support browser extensions?
- Context menus in Chrome extensions
- Chrome extensions - Other ways to read response bodies than chrome.devtools.network?
- Creating a chrome extension which takes highlighted text on the page and inserts it into a textarea in popup.html
- Message Passing Example From Chrome Extensions
- Cross-domain AJAX calls in Safari and Chrome
- Getting the actual URL after a POST which redirected using jquery .ajax()
- Keyboard Shortcuts in Google Chrome / Chromium Extensions
- Which elements can be safely made contenteditable?
- Can XAML 2009-related markup extensions be used in WPF?
- Is it correct to assume that floating-point samples in a WAV or AIFF file will be normalized?
- Android Build with Gradle and ProGuard : “The output jar must be specified after an input jar, or it will be empty”
- XHR request is denoted as being cancelled although it seems to be successful [closed]
- 2.23: Apps must follow the iOS Data Storage Guidelines or they will be rejected [closed]
- Link to chrome://chrome/extensions from extension options page
- A machine has 2 NICs. Which one will be utilized when connecting to a socket?
- How do I enable/disable google chrome extensions via console
- better many small ajax request or a big one for global site performance?
- Chrome window.open after ajax request acts like popup
- Which approach is better to read Windows Event log in C#? WMI or EventLog
- How to test inline installation of Chromium/Chrome extensions locally?
- Is there a function or package which will simulate predictions for an object returned from lm()?
- Chrome extension run content script on ajax change
- Which transaction is better with Dapper: BEGIN TRAN or TransactionScope?
- Viewing HTML response from Ajax call through Chrome Developer tools?
- my chrome extension popup opens after a few seconds, it's slow compared to other extensions
- Better way save password in mysql which can be decrypted also using php
- Chrome Network Web Developer Tool tab says Dojo AJAX requests are taking around 44 years to complete
- Online Image Editor - Ajax or Flex / Flash?
- Do I need to learn Javascript before AJAX or does AJAX not require Javascript knowledge?
- Which is a better string searching algorithm? Boyer-Moore or Boyer Moore Horspool? [closed]
- How to click an element which is loaded through Ajax through webdriver within Chrome
- showing several JS variables value in chrome extensions
- Symfony2, check if an action is called by ajax or not
- Chrome Extensions - Saving Settings
- Jquery ajax random error in Chrome only
- git- Creating a branch which will be pushed to a remote later
- Chrome and Firefox CORS AJAX calls get aborted on some Mac machines
- Ajax call not working chrome extension with manifest v2
- Access extensions in the chrome://extensions page
- Google Chrome Extension - prevent cookie on jquery ajax request or Use a chome.extension
- Is there any alternative to CORS google chrome extension? How to make successful ajax request without using CORS?
- Im passing a multi line text as argument which will be saved in a variable and then the file created has only 1 Lline
- How to download all files from Chrome Extensions example (subversion repo)?
- Source code of entire page including frames in chrome extensions
- how to create a php class which can be casted to boolean (be truthy or falsy)
- Which constructor will be called when registering services in ConfigureServices
- Secure handling of OAuth Consumer Key and Secret in Chrome Extensions and Gmail Gadgets
- Using Facebook sdk with Chrome Extensions
- Which Where condition on Datetime will be faster?
- Do Chrome extensions have access to Chrome apps?
- Chrome: Invoking 'alert()' during microtask execution is deprecated and will be removed
- How to set a promotional image in the Chrome Extensions list? [closed]
- Common Lisp's copy-tree: Which objects will be referenced in common by the original and the copy?
- How to pass a variable value between background scripts in chrome extensions
- Chrome and Safari ajax issue with async:false
- Checking for null, which is better? “null ==” or “==null”
- Which among importing companion object or extending trait is better
- How to use a specific GMT for a function which will be recognised by other time zones
- How to know which partition will be used in Postgres hash partitioning?
- HID compliant device will not enumerate using chrome.hid API on ChromeOS
- How do I check the AJAX request in Chrome
- How do I manually install extensions on Chrome for OS X?
- Chrome extension don't work when tested in chrome://extensions/
- Put method not working in Google Chrome through AJAX
- Using $.ajax or $.post to call MVC 5 Controller method
- How can I create Android Application plugins/extensions that can be installed as an APK or from market?
- Which is the better option to use: localStorage(), window.localStorage(), or document.localStorage()?
- Chrome Extensions - onRequest/sendRequest vs onMessage/sendMessage
- Cross domain ajax POST in chrome
- AddThis button will not work inside AJAX, but will work normally
- In which path does Visual Studio Code install extensions?
- Developing Chrome Extensions Using NPAPI in C++
- Apps must follow the iOS Data Storage Guidelines or they will be rejected
- What will be the side-loading and debugging mechanism for Android apps on ChromeOS?
- Named Query Or Native Query or Query Which one is better in performance point of view?
- Which loop has better performance? Increment or decrement?
- Which value is better to use? Boolean true or Integer 1?
- Google Chrome Extensions with Typekit Fonts
- Is SignalR a suitable substitute for jQuery Ajax (or similar)
- Which is better: Distinct or Group By
- Which is the better approach to web services - contract first or contract last?
- How can chrome.socket be used for broadcasting or multicasting?
- Which is a better method for storing images - folder or SQL Server as binary?
- Which one is better approach window.parent.location.href or window.top.location
- Chrome Extension: How to reload/re-execute content script on Ajax request
- Which things around case classes will be removed after Scala 2.9 exactly?
- Over-ride Chrome Browser spell check language using JQuery or JavaScript
- Apache2: mod_wsgi or mod_python, which one is better?
- Using Google Chrome extensions to import/export JSON files?
- Can I create django model, which will be not persisted in database?
- Is there a better Ajax Push for JSF 2.0 than Icefaces
- How to create Chrome extension that will search for text in source and alter formatting
- Building Chrome Extensions with Vuejs and Vuecli
- How i load a webpage in a popup chrome extension without iframe and using ajax
- Will the source mapping in Google Chrome push to Error.stack
- Jquery Ajax Firefox not sending cookie (Chrome works)
- jquery ajax - return json or plain html better
- Chrome Extension: how to change origin in AJAX request header?
- Loader not working during synchronous ajax call in chrome
- requestFullscreen() is deprecated on insecure origin, and support will be removed in the future
- Can Chrome extensions communicate with each other?
- Chrome Extension - Injected Iframe not accessing Chrome browserAction or chrome.tabs or AngularJS
- How can I find which interface a connection to a given host will be routed through?
- jQuery $.ajax response empty, but only in Chrome
- Which is the better approach to remove the redundant white space in XML [strip-space or indent="no"]?
- how to detect if a request is ajax or normal on server side
- How to specify a validation rule in Yii2 which will be greater than or less than of a specific number or value?
- Chrome extensions: make chrome.tabs.query() synchronous
- Chrome will not refresh local file when changing backbone template
- Which value will be sent by <textarea> and why?
- How to replace short (less than a minute) setTimeouts in Event Page Extensions
- Swift.Extensions var and func. Which one is better? [closed]
- How to select Chrome extensions to enable when using Selenium
- Use AJAX or Multithreading to speed up Page load
- How can we print the variable name along with its value in python, which will be useful during debugging?
- How to decide if a method will be private, protected, internal or public?
- Where to store the JSON file which will be referenced for the environment variable in asp.net hosted on Azure
- Security considerations for an ASP.Net web application that will be used on a public computer or kiosk
- const value vs. #define, which kind of chip resource will be used?
- Ajax Form breaks after adding html5 attributes in Chrome/Safari
- Google Chrome extensions document.title not working
- Intercepting AJAX requests on Chrome for iOS?
- Will and When will Mobile Browers support getUserMedia?
- How can I guarantee that an ajax response will be cached?
- Possibility for a website to track the user's chrome extensions, or their behaviour?
- Dynamically deploying content scripts in Chrome extensions
- Which one is better? Ajax post or page post[Controller httppost] when only one form is there in a page?
- Chrome Extensions synchronous calls - create window only after window closed
- how to ajax post a form that includes fields in a dynamic table for which both rows and columns can be added...
- Chrome extensions with jQuery
- Ajax link which can also be opened in new tab? (like Facebook)
- How to detemine which network interface (ip address) will be used to send a packet to a specific ip address?
- Chrome will not cache CSS files. .js files work fine
- Which one is better: DMG or PackageMaker
- Which method is better/ faster for performance - createElement or innerHTML?
- Chrome Extensions: Insert text into textfield when clicking button in pop-up
- Chrome Extensions - Button in popup.html
- Gmail Content Security Policy on Chrome extensions
- Converting an old windows base application (with fox pro) to web base application (asp.net with c# csharp)-which...
- Which is a better practice - global import or local import
- Which way is better? Save a media file to MongoDB as array of bytes or as string?
- In case of bit fields, which one is better to use, unsigned char or unsigned int and why?
- Which one is better between TextView or WebView?
- What is the "shell" window type in chrome extensions? Can it be used to hide a window?
- In Chrome extensions, can you force some javascript to be injected before everything?
- Google Chrome inset box-shadow bug on Windows, not on Mac: Better workaround?
- chrome.tabs.onCreated and executescript for Chrome Extensions not working
- Can I create self-signed certificate in Java which will be automatically trusted by web browsers?
- Ability to launch chrome with extensions loaded with watir-webdriver
- Open chrome://extensions from web using link
- Which should be singleton in one application? MongoClient or MongoDatabase or MongoCollection?
- Infinite scrolling with ajax does not work with Chrome
- in NSString, NSNumber type property, which is better: retain or copy? (and how about NSArray?)
- Pass Anonymous function that requires a parameter, to another function as an argument which will be assigned to an...
Only authorized users can answer the Search term. Please sign in first, or register a free account.
you should use the message passing api whenever you want to communicate between content scripts and your other pages. i don't see how you want to use ajax here.
if you're communicating between let's say your background page and the browseraction popup you could also use
chrome.extension.getbackgroundpage
which simply returns you thewindow
object from the backgroundpage. due to the restrictions imposed on content scripts you can't use this function in content scripts. this means you will always have to use message passing api for content scripts.don't be fooled by the asynchronous nature of these message passing functions. it's just a design consideration from the chrome team to use asynchronous functions (with a callback) everywhere. it doesn't mean they take a lot of time to execute. although i haven't bench-marked them, they seem to execute almost instantaneously.
edit
i misinterpreted your question. i thought you were asking about how to communicate between the different pages in your extension/app. what you are really asking is how to communicate with a web server.
the message passing api (
sendrequest
) only works for communication between different parts of your app. the reason why this api is in place is because different parts of your app run in different environments, these are called isolated worlds. these environments are completely separated from each other to protect you from malicious code. the only pinhole through these different environments is this message passing api.if you want to communicate with a web server ('pages' as you call them) you will need to use ajax. with ajax you will also notice the tight security model of chrome. under normal conditions a webpage is only permitted to make requests to the same site it originates from. this is called 'same origin policy'. because your extension/app is not hosted (it is packaged) it has no rights to access a web server by default. you, as a developer, will have to request this right to the user. you can do this by filling in the
permissions
property in the extension manifest. whenever the user installs your app he has to accept that you have the right to access a certain web server.as i read your question i am assuming you are still not very familiar with chrome extensions, apps, ajax and policy in a browser. i encourage you to read further on these topics while you are developing your app so you can ensure the security of your users.
edit 2
ok, so you're communicating between two different parts of your app, the index.html and the background.html. for this you can use
getbackgroundpage
and directly call functions defined in your background page. what you do is the following: in your backgroundpage:then you can call the following function on your main page (index.html):
it's that simple. you don't need any ajax or
sendrequest
for this. no asynchronous code at all. you can just call a function in a synchronous fashion and this will be returned:i didn't benchmark this and i haven't seen any data about it yet but i'm pretty sure this code is a lot faster than the message passing api or ajax. i didn't know you could use
xmlhttprequest
within your extension but if it's possible i expect it to be the slowest way since you're actually making a network call in stead of calling to in-memory objects. if you want to be sure about the timings i suggest you to benchmark them yourself. you can easily do this with chrome by using the following code:the time to perform this operation will be printed to the console.
edit 3
now that i think about it, i'm not really sure how you would do ajax between two pages inside an extension. don't you need a web server for this task? can you give an example in your question of how you achieved this in your app?