Post

Replies

Boosts

Views

Activity

How to take a screenshot of a tab
Hello, Is it possible to take a screenshot of a non-active tab? Firefox supports this via captureTab (https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/captureTab) With Safari App extensions that was possible via getScreenshotOfVisibleArea which doesn't seem to work with Safari extensions.
1
0
750
Feb ’24
declarativeNetRequest.Redirect - Does Safari fully support it?
Hello, According to MDN, Safari v15.4+ should fully support declarativeNetRequest.Redirect, including regexSubstitution, but when I use it in a rule I get this: Rule: EXT_PAGE = '/hello.html'; RULES = [{ id: 1, action: { type: 'redirect', redirect: { regexSubstitution: EXT_PAGE + '#\\0' }, }, condition: { requestDomains: ['example.com'], regexFilter: '^.+$', resourceTypes: ['main_frame', 'sub_frame'], }, }]; browser.declarativeNetRequest.updateDynamicRules({ removeRuleIds: RULES.map(r => r.id), addRules: RULES, }); Error: Invalid call to declarativeNetRequest.updateDynamicRules(). Error with rule at index 0: Rule with id 1 is invalid. redirect is missing either a url, extensionPath, or transform key.
2
0
1.1k
Jul ’23
Unexpected(?) behaviour when loading an extension's internal URL
FB7597364 (attached video there) Hello, I have filled a radar but I'm wondering if I am misunderstanding the following (Safari TP 104+): Make the extension open a new tab with the baseURI and a parameter, eg.: safari-extension://2CB967-22BA-44F3-B604-72611F/aafefbf/test.html?title=Apple&color=red Here's the code I'm using: SFSafariApplication.getActiveWindow { activeWindow in 						SFSafariExtension.getBaseURI { baseURI in 								guard let baseURI = baseURI else { return } 								var urlComponents = URLComponents(string: baseURI.appendingPathComponent("test.html").absoluteString); 							 								urlComponents?.queryItems = [ 									 URLQueryItem(name: "title", value: "Apple"), 									 URLQueryItem(name: "color", value: "red"), 								]; 								activeWindow?.openTab(with: (urlComponents?.url)!, makeActiveIfPossible: true, completionHandler: {_ in }); 						} 				} 2. Wait for the page to load 3. Quit Safari 4. Open Safari Expected: Safari updates the baseURL of that tab and keeps the query parameters, eg: safari-extension://11111-new-baseURI-44F3-B604-72611F/o213s/test.html?title=Apple&color=red Actual: Safari updates the baseURL of that tab and strips the query parameters, eg: safari-extension://11111-new-baseURI-44F3-B604-72611F/o213s/test.html
7
1
2k
Nov ’22
How to take a screenshot of a tab
Hello, Is it possible to take a screenshot of a non-active tab? Firefox supports this via captureTab (https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/captureTab) With Safari App extensions that was possible via getScreenshotOfVisibleArea which doesn't seem to work with Safari extensions.
Replies
1
Boosts
0
Views
750
Activity
Feb ’24
declarativeNetRequest.Redirect - Does Safari fully support it?
Hello, According to MDN, Safari v15.4+ should fully support declarativeNetRequest.Redirect, including regexSubstitution, but when I use it in a rule I get this: Rule: EXT_PAGE = '/hello.html'; RULES = [{ id: 1, action: { type: 'redirect', redirect: { regexSubstitution: EXT_PAGE + '#\\0' }, }, condition: { requestDomains: ['example.com'], regexFilter: '^.+$', resourceTypes: ['main_frame', 'sub_frame'], }, }]; browser.declarativeNetRequest.updateDynamicRules({ removeRuleIds: RULES.map(r => r.id), addRules: RULES, }); Error: Invalid call to declarativeNetRequest.updateDynamicRules(). Error with rule at index 0: Rule with id 1 is invalid. redirect is missing either a url, extensionPath, or transform key.
Replies
2
Boosts
0
Views
1.1k
Activity
Jul ’23
Unexpected(?) behaviour when loading an extension's internal URL
FB7597364 (attached video there) Hello, I have filled a radar but I'm wondering if I am misunderstanding the following (Safari TP 104+): Make the extension open a new tab with the baseURI and a parameter, eg.: safari-extension://2CB967-22BA-44F3-B604-72611F/aafefbf/test.html?title=Apple&color=red Here's the code I'm using: SFSafariApplication.getActiveWindow { activeWindow in 						SFSafariExtension.getBaseURI { baseURI in 								guard let baseURI = baseURI else { return } 								var urlComponents = URLComponents(string: baseURI.appendingPathComponent("test.html").absoluteString); 							 								urlComponents?.queryItems = [ 									 URLQueryItem(name: "title", value: "Apple"), 									 URLQueryItem(name: "color", value: "red"), 								]; 								activeWindow?.openTab(with: (urlComponents?.url)!, makeActiveIfPossible: true, completionHandler: {_ in }); 						} 				} 2. Wait for the page to load 3. Quit Safari 4. Open Safari Expected: Safari updates the baseURL of that tab and keeps the query parameters, eg: safari-extension://11111-new-baseURI-44F3-B604-72611F/o213s/test.html?title=Apple&color=red Actual: Safari updates the baseURL of that tab and strips the query parameters, eg: safari-extension://11111-new-baseURI-44F3-B604-72611F/o213s/test.html
Replies
7
Boosts
1
Views
2k
Activity
Nov ’22