w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Why content.js load twice or more when in facebook.com with chrome extension?
I'm not sure if Facebook uses frames, but if it does it is possible that there are four frames that are executing your code once each. Chrome console doesn't give any visual indication that this is what is happening. Try setting all_frames to false so that it only executes on the top frame.

Categories : Javascript

Facebook JavaScript API for google chrome extension
I don't have a solution, but this might lead you in the right direction. The problem might be with the document.location of the extension document. For javascript running in the extension scope, the protocol is "chrome-extension://", while many JS libraries expect either "http" or "https". From looking at the following line at the jssdk file, it seems that FB make this assumption as well: var k = typeof j == 'undefined' ? location.protocol.replace(':', '') : j ? 'https' : 'http'; Try debugging these cases, replacing the line above with something like: var k = 'http'; Hope this helps.

Categories : Javascript

POST request on Facebook.com in Chrome Extension fails
The only way to perform a cross-origin request when the page's CSP interferes is through a background page. You can find a complete example at Cross-domain XMLHttpRequest using background pages. Also, is there some place I can use to store data in Chrome Extension while using content scripts? Use the chrome.storage API, or use message passing and localStorage. See this answer for a more detailed explanation and sample code.

Categories : Ajax

Unable to access aria-label attribute in Chrome extension for Facebook
I had the same problem, to fix I simply had to change: $(this).attr("aria-label")); to $(this).getAttribute("aria-label")); and it pulled the value for me. Thought'd I would add my two cents for anyone else that may run into this problem.

Categories : Jquery

add button to page with chrome extension
You can use that code in a content script set to run on specific webpages. Content scripts are JavaScript files that run in the context of web pages. By using the standard Document Object Model (DOM), they can read details of the web pages the browser visits, or make changes to them.

Categories : Google Chrome

Chrome Extension: Create a new tab by click a button
You can use window.open(url, title, options) to open a popup window via JavaScript. options is a string containing one or more of these variables (or empty): width width of the window height height of the window location URL visible or not status statusbar visible or not menubar menubar visible or not directories I'm guessing this is the bookmark bar toolbar toolbar (back, home, etc.) visible or not resizable whether or not resizable scrollbars whether or not to enable scrollbars e.g.: window.open('http://website.com/popup.html', 'Popup Window', 'width=640,height=480,location=yes,scrollbars=yes');

Categories : Javascript

When button clicked change textbox value in google chrome extension
You need to change onClick to onclick. JavaScript is case-sensitive. Edit I am still not sure if your code is an extension or not but here is how you could ensure that the page is fully loaded if you attach your code to the onload event. function LogIn(){ document.getElementById('UserName').value='test'; document.getElementById('Password').value='test2'; } window.onload = function(){ document.getElementById('Login').onclick=LogIn; }

Categories : Javascript

Fire extension on very page Google Chrome Extension
I would use chrome.tabs API instead of chrome.windows API. http://developer.chrome.com/extensions/tabs.html onCreated event and onUpdated event should work. chrome.tabs.onCreated.addListener(function callback) chrome.tabs.onUpdated.addListener(function callback)

Categories : Google Chrome

Chrome Extension API: chrome.tabs.captureVisibleTab on Background Page to Content Script
Use chrome.tabs.sendMessage background page: chrome.runtime.onMessage.addListener( function(request, sender, sendResponse) { chrome.tabs.captureVisibleTab( null, {}, function(dataUrl) { sendResponse({imgSrc:dataUrl}); } ); //remember that captureVisibleTab() is a statement return true; } ); content script chrome.runtime.sendMessage({msg: "capture"}, function(response) { console.log(response.dataUrl); });

Categories : Javascript

how to implement Chrome extension 's chrome.tabs.sendMessage API in Firefox addon
In add-ons build using the Add-on SDK, content scripts are managed by main.js. There's no built-in way to access all of your add-on's content scripts. To send a message to all tabs, you need to manually keep track of the content scripts. One-way messages are easily implemented by the existing APIs. Callbacks are not built-in, though. My browser-action SDK library contains a module called "messaging", which implements the Chrome messaging API. In the following example, the content script and the main script use an object called "extension". This object exposes the onMessage and sendMessage methods, modelled after the Chrome extension messaging APIs. The following example adds a content script to every page on Stack Overflow, and upon click, the titles of the tabs are logged to the consol

Categories : Javascript

How do I get the the google chrome chrome.windows.create extension function to work
inline javascript codes are not allowed (by default) in chrome extensions. so you have to change the code like this. <html> <head> </head> <body> </body> <script src="loader.js"></script> loader.js: function load() { chrome.windows.create({ url: 'http://www.google.com', type: 'panel' }); } document.getElementsByTagName( 'body' )[0].onload = function() { load(); }; For more information about content-security policies visit: Content Security Policy (CSP) - Google Chrome

Categories : Google Chrome

Porting Chrome extension to Firefox : equivalent to chrome.storage
Yes exactly, it is simple-storage. You can use it like this : const storage = require("sdk/simple-storage").storage; storage.tokenFu = token;

Categories : Javascript

Chrome extension: Execute background page only once when chrome starts
What you are using is an Event Page(background_page.js). Event pages are unloaded when the browser detects that the page is not doing anything. So what's happening is that when you open a new tab, the Event page is being reloaded and starts executing from the top again. This way chrome is able to have your app use less memory and speed up the browser. If you want to fix the problem simply use persistent:true which will make sure the page "persists" indefinitely or until the user closes the browser. If you would really like to keep your app efficient with memory, you should take a look at the runtime.onSuspend method which gets called each time your Event page unloads. This way you can save stuff before the page gets unloaded so that you can resume where you left off.

Categories : Google Chrome

Is there a way for a packaged hosted chrome extension to request chrome updates it?
Have you tried using chrome.runtime.requestUpdateCheck()? Your code could be something like this: chrome.runtime.requestUpdateCheck(function(status,details){}); chrome.runtime.onUpdateAvailable(function(details){ console.log('Updating to version: ' + details.version); chrome.runtime.reload(); });

Categories : Google Chrome

a href to chrome:// url in a chrome extension how to make it work
You cannot access chrome pages from an extension. However you could get some settings with Chrome APIs Specifically Bookmarks API, Installed extensions API

Categories : Api

Difficulties saving URL from Chrome tab (for Chrome extension)
This is because when you declare your "query" variable, it only has scope within your callback function in chrome.tabs.query. Now, you could declare your variable at the top of your script to give it scope within the entire script: var query; chrome.tabs.query({'active': true}, function (tabs) { query = tabs[0].url; }); chrome.browserAction.onClicked.addListener(function(activeTab) { var stemURL = "http://www.google.com/#q=link:"; chrome.tabs.create({ url: (stemURL + query) }); }); ...or you could use your activeTab variable that chrome.browserAction.onClick passes to you and grab the active tab's URL from that to ensure that you open the search results for the tab that the user was viewing when they clicked your extension's button, which would also have the added advantage

Categories : Javascript

How to use chrome.alarms for Google Chrome extension
You didn't create any alarm, so no onAlarm event will be fired. Create an alarm with chrome.alarms.create. Note: you should do it in the chrome.runtime.onInstalled event.

Categories : Javascript

How can I have a dynamic image show when someone clicks the Facebook Like button and Posts to Facebook?
Change the meta tag on click: use this example and modify it to your needs. <!DOCTYPE html> <head> <meta charset="utf-8"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> <title>Title Of Page</title> </head> <body> <input type="button" value="Click Me" onclick='$("title").html("Changed Dynamically");'/> </body> </html>

Categories : Facebook

How can I add a Facebook share button using the Facebook Javascript SDK in an Ajax call?
Try this. <script type="text/javascript"> $(document).ready(function() { $('#share_button').click(function() { FB.ui({ method: 'feed', name: '<%= fb_data[:name] %>', link: '<%= fb_data[:link]%>', picture: '<%= fb_data[:picture] %>', caption: '<%= fb_data[:caption] %>', description: '<%= fb_data[:description] %>' }); }); }); </script> Does it work ?

Categories : Javascript

Chrome extension to dim the background
I can only assume that it looks for or elements in the page using some selector. Then it would add the div to dim the background using a content script, changing the z-index of the found video element to a higher value.

Categories : Javascript

Can't upload Chrome extension
Can I comment a JSON file? You can't include comments in JSON. Raw JSON must be strictly data and contain no // comments. I pasted your code into a JSONLint validator, and as expected, it throws a hissy fit. Parse error on line 30: ...con": { //optional"19": "eye ----------------------^ Expecting 'STRING', '}'

Categories : Json

qemu extension for Chrome
You don't need special extension to access QEMU virtual machine screen from Chrome - there are several VNC clients written in JavaScript, and QEMU supports VNC output. For example noVNC client works fine, if you don't forget to run websockets proxy. Something like qemu-system-i386 -hda /home/user/myhddimage.qcow2 -usbdevice tablet -vnc :3 & cd /home/user/noVNC ./utils/websockify --web ./ 8783 localhost:5903 & google-chrome file:///home/user/noVNC/vnc_auto.html?host=localhost&port=8783&encrypt=0&true_color=1

Categories : Google Chrome

Chrome Extension ContextMenu for PDF
I'm guessing that you want to add a context menu only when a PDF is shown in a tab, right? Just asking because I thought at first that you wanted to add the context menu on links to PDF files, which is indeed possible*. (as you probably know) I couldn't find a way to do this directly, however one alternative could be to listen to chrome.tabs.onActivated and add or remove your context menu based on if the current URL matches a PDF file. One drawback is that it means asking for the tabs permission which might looks scary to users. ("This extension can access your tabs and browsing activity" or something like that) *for the curious, you do it like this: chrome.contextMenus.create({ title: "Hello world", contexts: ["link"], targetUrlPatterns: ["*://*/*.pdf"] }); (you would add

Categories : Javascript

Chrome extension callback
Add code like this in your background file: if(!localStorage.first){ chrome.tabs.create({ url : "http://whatever.com/welcome.html" }); localStorage.first = "true"; } from redirect to page.html after chrome extension installs

Categories : Javascript

How to run url in background of chrome extension
For Uncaught Error: JavaScript API Domain is restricted to localhost Go to your application made in linkedin and in javascript option sdk the added url is of localhost and another url there.

Categories : Javascript

Chrome Extension as GUI for JSON API
Yes, you can create your GUI in pure HTML, CSS and JavaScript. This is actually the only way to make a GUI in Chrome extensions. Your PHP based API can certainly be accessed via an extension, if designed as a fairly typical client side accessible API. Here's a brief description of Extensions and Packaged Apps: Extensions are generally designed for augmenting the browser experience. For example, analyzing the pages the user is browsing and highlighting text. Chrome exposes several awesome APIs related to the browser and the browsing experience. However, it's just JavaScript, CSS and HTML, so it's definitely possible to take it a step further and create pretty much fully functional applications. However, there are no UI specific features in the Extension API that would make it easier to c

Categories : PHP

How to exit Chrome from an extension?
Install the bleeding-edge version of Chrome (get if from the dev channel or use Canary) and create an extension that uses the chrome.processes API. It seems that the browser's process has ID 0. So, the following code will terminate Chrome: chrome.processes.terminate(0); However, since this is not documented, I suggest to get a list of processes, loop through the list and terminate the browser's process: chrome.processes.getProcessInfo([], false, function(processes) { processes.forEach(function(process) { if (process.type === 'browser') { chrome.processes.terminate(process.id); } }); }); Alternative methods that work in all Chrome versions: Create a NPAPI plugin and kill Chrome. Host a local server of your choice that terminates your browser on (

Categories : Javascript

Chrome Extension Issue
Alright, fixed when the first comment reminded me to check my chrome console. Anyway, I found the fix here: Determining where Maximum call stack size is being exceeded EDIT: New fiddle here: http://jsfiddle.net/Ultimate/TpsBv/5/ setTimeout(function() { sayHi(); }, time);

Categories : Javascript

cant' add listener in chrome extension
Eh...I just gave up and moved add button listeners logic to another place like that: document.addEventListener('DOMContentLoaded', function () { document.getElementById('loadall').addEventListener('click', loadAll) }

Categories : Javascript

capture URL in chrome extension
Listen for the onUpdated event. chrome.tabs.onUpdated.addListener(function(integer tabId, object changeInfo, Tab tab) {...}); http://developer.chrome.com/extensions/tabs.html#event-onUpdated

Categories : Javascript

My chrome extension isn't synced
Chrome will only sync apps that are published to the web store. For more information on how to integrate your extension's data with sync, see this page: https://developer.chrome.com/extensions/storage.html

Categories : Google Chrome

Chrome extension or chrome app?
Either, or... Go with an extension if you'd like. I assume you've looked at the API reference? https://developers.google.com/google-apps/calendar/ From there, I'd imagine you'd just need OAuth to authenticate the user. Here's the JS library: https://code.google.com/p/google-api-javascript-client/

Categories : Google Chrome

How to show facebook like button even if user isn't logged into Facebook?
It displays regardless of whether a user is logged in or not. If the user is not logged in and clicks on Like, they get a popup that says "You must log in to see this page." Are you sure you're including the fb-root div and the Javascript? <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=Your-App-ID-HERE"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>

Categories : Javascript

Facebook Like button 404 error for connect.facebook.net/en_US/all.js
I noticed that it worked when I accessed my page from another network. Digging into it further, I found that it was a firewall on our network that was blocking requests to connect.facebook.net/en_US/all.js.

Categories : Facebook

Facebook Like Button Post to Facebook Box is Not Showing Properly?
Try to turn off "sending" and "show faces" functions for it. XFBML code should thendisplay the button look something like this: <fb:like href="yoursite.com" send="false" layout="box_count" width="150" show_faces="false"></fb:like> Other thing could be that the FB button is partially overlayed by another layer. Try to wrap the code above to <div></div>, create a class for this div like that <div class="myclass"></div> and then use a z-index css property like this: .myclass { z-index: 1; }

Categories : CSS

facebook like button at the end, is it ok? even is facebook recomends putting it after the
You can put it anywhere as long as it is before </body> tag. I have used it myself at the end of the page without any problem, but there might be some side effect in some cases as the Facebook official documentation says This code works best when placed directly after the opening tag. Check out this answer It doesn't particularly matter where you put it, so long it's BEFORE the </body> tag. Adding it to the top of the page (just after <body> makes sure that the SDK gets downloaded and is available to the page should any javascript further down the page try to access the FB object directly. Your <div id="fb-root"></div> needs to be above wherever the <script>...</script> tag is placed, so the SDK can locate that div to add resources

Categories : Facebook

Chrome extension action on shutdown
This document lists an onSuspend event: Clean-up before app closes The app runtime sends the onSuspend() event to the event page before unloading it. Your event page can listen out for this event and do clean-up tasks before the app closes. Once this event is fired, the app runtime starts the process of closing the app: all events stop firing and JavaScript execution is halted. Any asynchronous operations started while handling this event are not guaranteed to complete. Keep the clean-up tasks synchronous and simple. chrome.runtime.onSuspend.addListener(function() { // Do some simple clean-up tasks. }); This document says the onSuspend is also available for extensions

Categories : Javascript

Load chrome extension programatically
You can do it by using Desiredcapabilities. DesiredCapabilities capabilities = DesiredCapabilities.chrome(); capabilities.setCapability("chrome.switches", Arrays.asList("--load- extension=/path/to/extension/directory")); WebDriver driver = new ChromeDriver(capabilities); for detail visit here

Categories : Javascript

REST Console Extension in Chrome
You have a couple other options: Chrome: Postman - REST Client Advanced REST client Firefox: RESTClient REST Easy (thanks to Nathan) See if some of them meet your needs

Categories : Google Chrome

Chrome Extension Installation Silently
Since Chrome 25 it is no longer possible to install extensions silently. Even when installed from outside of Chrome an extension will still require a confirmation. Some resources related to this issue: http://blog.chromium.org/2012/12/no-more-silent-extension-installs.html https://code.google.com/p/chromium/issues/detail?id=172608 http://www.infoworld.com/d/applications/chrome-25-will-disable-silently-installed-extensions-209780 Having said that, if you do find a way to install an extension silently without confirmation, please report it as a bug to the chromium team :)

Categories : Google Chrome



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.