Is it possible to detect if evaluateOnNewDocument was called - google-chrome

Chrome is providing an interface to evaluate a given script in every frame upon creation (before loading frame's scripts).
For app's integrity check, I was wondering if there is a way to detect this within the page's scope script, meaning, evaluating a property within window.navigator or such to tell whether there was a custom script execution prior to page loading.

Related

How do I start a DevTools user flow recording from a dynamic URL?

Google recently released their DevTools user flow recorder and it seems like an interesting and easy-to-use tool. One limitation I'm running into is that replaying a recording will always bring you to the page you initiated the recording on. For example, if I create and save a recording on this array processing question then navigate to this git question, running the recording on the latter will redirect me back to the former. I would like to be able to make a recording, then kick it off from whatever page I'm currently viewing. So far, I've tried both removing the URL from the initial step and replacing the initial URL with a JS IIFE that gets the current URL; neither of these have worked.

Autodesk Forge does not allow multiple OAuth2 callback URL for one app

It is common to have multiple environments doing dev, staging and production. Forge App creation page also instruction that this is possible. However, no matter how I fill in the field, I always get a rejection. Please instruct how this field can be filled in with more than one callback URL.
Currently it is only possible to specify a single callback URL. You can however change it whenever needed, by clicking the EDIT button in your Forge application page.
Btw. we are already working on adding support to multiple callback URLs but don't have an ETA on when it's going to be available to the public.

What happens if you call watchPosition and change page without calling clearWatch?

I am using HTML5 geolocation watchPosition. I have a page that calls watchPosition once that constantly checks the user's location. I am curious what happens if I transfer to another page within the website without calling the clearWatch function. Will watchPosition continue to run and get location data?
No. All Javascript that was loaded with the page gets discarded and stopped. That includes all event watchers and geolocation watch requests.
The only thing that has even a chance of continuing to run in the background are web workers, which you very explicitly need to get up and running.

Call Web resource (Html/JS) from CRM plugin?

I want when some code in plugin execute, then call or trigger on some way a web resource, so is it even possible and how I can call it?
NOTE: its important that first execute a plugin and then web resource!
A plugin cannot directly communicate with form script. However communication can be achieved through the data model. Based on your comments, I would suggest the following approach.
Create a plugin to create and store the document against the case record. (Perhaps set a flag field on the case to indicate the document is available).
In your web resource have JavaScript which queries CRM using OData to see if the document is available (perhaps based on the flag field). Then provide the document for download. You may also need to make some consideration around when to offer the download, as form script will run every time the form is loaded, constantly offering the document for download could be annoying for the user.
Alternatively, just do step 1. Then the user can download the document manually like every other attachment. If you have a flag field its easy to show a message that the document is ready.

Google Maps not designed to work in multi-views?

Checking my understanding of Google maps:
I am developing a web page that displays a number of different types of information for my employer's facilities. I have been using a multiview, and activating the proper view depending on user input (button toolbar). When I add a view to be a map to the selected building, I run into problems. I can make the map appear when the user navigates to the building map view. But when the user navigates away from that view, the maps api gives me the error
0x800a138f - JavaScript runtime error: Unable to get property 'offsetWidth' of undefined or null reference
As I understand it, this is because when another view becomes active, the view that contains the map is no longer rendered. The api is trying to access an object that no longer exists.
I could try to clean off the object - remove all listeners, delete the object, even delete the div that contains it. But I have just read through the related question on how to destroy a map instance and listened to Chris Broadfoot and Luke Mahe's discussion on the topic.
From this, my understanding is that the google maps api was not designed for this kind of handling. So, it is really not designed to be compatible with something like multi-views.
Is this right? If not, what am I missing? If so, any suggestions for a web app newbie on what to use instead of multiviews (I am thinking panels and hide/show as needed)?
Update and kind of an answer...
I switched to using multiple panels and hiding all the panels, except the one with the information the user chooses to use. The map then displayed blank unless I did one of two things: set the map to be created as an endRequest...
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(myInitMap);
If I understand that correctly, it means my handler (myInitMap) gets executed (map recreated) after every postback. Also, this seems to be a bit unstable - sometimes IE would give me errors, and I could not figure out a pattern or reason. Chrome would work ok every time.
The other way that worked was to not call the map creation on any particular event, but rather to register my map init script from the code-behind page_load event. My panels and my multi-view had been encased in an Update Panel, and I needed to register the script under that Update Panel...
ScriptManager.RegisterStartupScript(DataUpdatePanel, DataUpdatePanel.GetType(), "ShowGoogleMap", "myInitMap();", true);
This is because what is causing problems, I think, is that my panels (and my multi-view in the earlier version) were inside that UpdatePanel. The map creation script and API calls were not happening in the right sequence with everything else as the UpdatePanel performed a partial page update. Registering the map init scrip with the Script Manager basically told it to put it in the right place (at the end?) of that partial page update.
Also, I could not figure out how to update the map. The script is basically regenerating the map every time. I tried keeping a var pointer to the map so that I could test if that had already been created, and then just update it, but that did not work. The UpdatePanel partial page update is, I presume, working much like a whole page refresh, but for only what is contained in the UpdatePanel. So when the partial update happens, the previous contents are disposed of and recreated, so the map has to be recreated as well.
If anyone understands this differently, I would love some redirection.