repeated google maps script tag - javascript

I have developed a simple application with Google maps (API 3). This application loads a store's menu dynamically, so if the user click's a store item, the map shows the specific location of the store.
For that I have applied "Asynchronously Loading" from the Developer's guide, it works perfectly, but I'am concern that every time the user click a store item (with out reloading the page), a script tag in the body is inserted.
Is it possible to have further problems because of that, performance , anything ?

Related

chrome extension manifest V3 - how to clear storage on specific tab close?

I have a bit of complicated chrome extension which it's task is to scrape an HTML table that spans over multiple pages, each page is backend-rendered.
Thanks to the extension mechanics, I can store the table data in storage.local, and once the extension auto-paging to the next page, the extension adds up its table data.
So far it works like a charm, but the problems starting once I close the tab where the table is. The final goal is to clear the table data storage object only when the user closing the exact same tab where the scraping was active.
So far I've tried the following approaches:
chrome.tabs.onRemoved - as described here, doesn't work - it activates on every closing tab, what I'm not interested in. I cannot catch the active tab before it closing because the chrome already unloaded the tab and the active becomes the one I just moved into.
window.onbeforeunload or window.unload also doesn't work - it triggers every time the page is refreshing or moving to the next table page (remember - it's a backend rendered table, table with multiple pages triggering the unload with every page change)
My question is - How can I clear the storage once user shuts down the specific tab the scraper was working at?

Simulating click on react element

There is a list on a website and I am trying it simulate a click on that list item. Normally, if I click the list item with the mouse, it gets selected.
The website is created with React. I can see it in React Dev Tools too.
I tried combinations of these on the <li> element:
$($0).click();
$($0).trigger('click');
$($0).mouseover();
$($0).trigger('mouseover');
$($0).mouseenter();
$($0).trigger('mouseenter');
What is the proper way of achieving it?
P.S: The website is 3rd party and I am trying to perform the click via chrome extension - content script (basically with injecting my script in a 3rd party page)
The website is Facebook Ads Manager > Traffic

Javascript onclick method in ArcGIS iframe is disappearing

I'm using ESRI's ArcGIS Web App to create a map that has several interactive features. By clicking on specific objects in my map, users will see a pop up (created using the Web App creation features) with information about the area they clicked on.
Some of those pop ups contain a link that should open up a new window to display an image (that I have hosted on my web server).
Here's where my problem begins. In the map builder, inside my ArcGIS online login where I set everything up, I have added the link control to the configured popups that tells it to use Javascript in an "onclick" to tell it to open a new window, of a specific size, and where to find the image to display. It all works fine in the builder. But as soon as I create the web app, it completely drops my "onclick".
And more-so, I tried to work around this by changing the href of the link to "javascript:myScriptHereTellingItToOpenANewWindow" and the web app then drops the "javascript:" part and changes it to "#" thus still not working when I click it, all it does is try to open a new browser tab and ignores the rest of the script written in the href.
I'm sorry I have to be somewhat vague because this is for a company project that has high security. Below is what little code I can share (cleaned up a little to hide confidential information).
In the ArcGIS Web Map builder, here is the code I have in my configured popup:
<a onclick="window.open('URL of image file I want to load','width=1000,height=202,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');" style="cursor:pointer;" target="_parent">View Featured Line</a>
And as I said, that works fine in the editor. But once I chose to "Create a Web App from this map" it drops the "onclick" completely.
If I put it in the href tag, like below:
View Featured Line
Then when I "inspect source" in the web app, it looks like this (which doesn't work either):
View Featured Line

Will Firefox start my SDK extension automatically after the browser starts - loading screen

I am new on add-on development using the SDK.
I want to ask you guys if it is possible to start my extension automatically after I open my browser? At the moment I starts after I press my widget icon in the toolbar (the panel shows a table with some data I get from the DOM).
Another thing I want to ask you: is it possible to show a loading screen (like a ajax gif) inside my panel (my extension needs a few seconds after switching a tab, to get the DOM data) every time I press the toolbar button.
First of all: One question per post, please.
Extensions are always started with the browser. When it comes to SDK add-ons, your main.js will be called. It's your job to perform any additional initialization form there.
Panels contain regular HTML pages and therefore can use images.
It's impossible to tell you more, without you providing more details and the code you got so far!

How to translate entire website with Google Translate

I am currently using the following to translate a web page:
http://translate.google.com/about/intl/en_ALL/tour.html#professional
The problem is, when I put the code snippet generated on the Google site onto my web pages, the user has to choose their language on each page in the website. Is there any way to do it so that the user only chooses once and then every subsequent page they visit in my website gets automatically translated to their chosen language?
It appears this problem only shows up when using Google Chrome. Other browsers work fine:
http://groups.google.com/group/google-translate-general/browse_thread/thread/4b48a4f997762692
The translation widget at the bottom of this page takes the approach of redirecting to google's page translation service which maintains the language but your page has to run inside a google container:
http://www.toronto.ca/
You might be able to listen to change events on the in-page translation widget and store the selected language in LocalStorage so you can automatically reselect it whenever a new page is loaded. However, this approach is pretty hacky since it could easily break whenever google alters the widget.

Categories