safari-extension

Safari Web Extension - injecting script only when extension button is clicked

非 Y 不嫁゛ 提交于 2020-07-31 05:45:38
问题 To keep it simple, I am taking reference for SeaCreator extension example from Apple. You can take it from here: https://drive.google.com/file/d/1loBDgkJAEtyh0QehOUlgOSyUnW9ZZDk6/view?usp=sharing In this example as mentioned, we are replacing fish names with different emojis . The thing is when we tap on the extension icon, it turns into blue to indicate the extension is active and whenever any page is rendered, all fish names will be automatically replaced with emojis. See screenshot -> What

Executing host script from an injected page

半城伤御伤魂 提交于 2020-01-31 16:43:19
问题 I'm writing a Safari Extension that adds some functionality to a web page that I don't own. I would like for my injected JavaScript page to be able to fire some JavaScript functions the host page uses, but it doesn't work. On the Console I get the message ReferenceError: Can't find variable: function_name . My script is specified to be an End Script, so the whole page should be loaded. The function is also called from an onclick() handler on the page, like so: onclick="function_name($(this)

Executing host script from an injected page

别等时光非礼了梦想. 提交于 2020-01-31 16:43:13
问题 I'm writing a Safari Extension that adds some functionality to a web page that I don't own. I would like for my injected JavaScript page to be able to fire some JavaScript functions the host page uses, but it doesn't work. On the Console I get the message ReferenceError: Can't find variable: function_name . My script is specified to be an End Script, so the whole page should be loaded. The function is also called from an onclick() handler on the page, like so: onclick="function_name($(this)

/How to get active Tab url in safari browser using java script

烂漫一生 提交于 2020-01-23 14:02:29
问题 How to get the browser window or active tab url using java script in a safari browser ? I tried to do it using -> document.url window.location.href But both this solutions are giving me so many urls . I dont know why ? Also I have searched that safari.application.browserWindow.activeTab gives obj of current active window . But I dont know which methods are provided by activeTab class If anyone knows , plz help me . Thanks in advance. 回答1: If you just want the URL of the "top" document in the

Cannot read property 'helpers' of undefined with babel and webapck

痞子三分冷 提交于 2020-01-14 13:34:27
问题 I'm trying to build a Safari extension. Since I can't use require or import in the browser, I am trying to set up Webpack and Babel. I replied heavily on some other examples I found, but no joy. Any help appreciated. webpack.conf.js const path = require('path') module.exports = { target: 'web', entry: './src/index.js', output: { path: path.resolve(__dirname, "ReduxDevTools.safariextension"), filename: 'index.js' }, module: { rules: [ { test: /src\/.+\.js$/, exclude: /(node_modules

Current URL in Safari Extension

余生长醉 提交于 2020-01-14 07:37:11
问题 safari.application.activeBrowserWindow.activeTab.url is always undefined . Any idea why this might be? 回答1: My impression is that this happens when the loaded page is not “allowed” in the Extension Website Access section of the extension’s configuration. Only the websites you choose have web content injected into them, and only those websites can be manipulated using the tab object’s properties, such as title and url . Also, it seems that the Whitelist and Blacklist settings are applied “on

Safari Extension : retrieve full HTML code from a page

烈酒焚心 提交于 2020-01-07 02:57:26
问题 i'm trying to create a safari extension and i'm stuck with something. I have my global.html on my extension and i've been searching the web for like 3hours on how to retrieve the full html code without success. I tried: document.getElementsByTagName('html')[0].innerHTML (when i alert i only see the code that i have inside my global.html) document.documentElement.innerHTML (nothing happens) etc... I used safari.application.activeBrowserWindow.activeTab.url to retrieve the url but i cant get

How do I test a Safari extension with Selenium in Python?

巧了我就是萌 提交于 2020-01-07 00:31:51
问题 We created extensions for Chrome, Firefox and Safari and we want to test our extensions with Selenium. I already created tests for Chrome and Firefox with our extension, and now I want to test our Safari extension. I found this answer about Safari but I didn't find out how to do it in Python, I checked and Selenium 2.45.0 (which we are using) doesn't have SafariOptions defined, and I didn't find out how I add an extension to the Safari tests. We use remote testing with Safari and I ran a test

Using Selenium Webdriver and Safari

馋奶兔 提交于 2020-01-02 06:18:24
问题 I am working on Selenium Webdriver C# using Visual Studio Express 2012. I installed the latest safari browser and I create the developer certificate for extension from Apple and I built the extension and install it. But even after that, I am not able to send the URL to the browser. The browser is launched successfully, but after that I didn't get any logs. The error message is: Additional information: Did not receive a connection from the Safari extension. Please verify that it is properly

Injecting jQuery to webpage from Safari extension

本小妞迷上赌 提交于 2020-01-01 17:08:32
问题 I just want to inject jQuery into a webpage from a safari extension. But only to some pages because adding jQuery as a start-/endscript would inject it to all pages and this makes browsing slow. I tried it by creating a script tag using its onload function: var node = document.createElement('script'); node.onload = function(){ initjquerycheck(function($) { dosomethingusingjQuery($); }); }; node.async = "async"; node.type = "text/javascript"; node.src = "https://code.jquery.com/jquery-2.0.3