Select to view content in your preferred language

Hyperlink in a pop up

2248
8
Jump to solution
08-15-2013 02:51 AM
JohnByrne
Deactivated User
I have a really silly question and it???s probably something simple, but I haven???t encountered it before.

The problem is essentially I have a hyperlink field within the attributes of a feature class which open to google maps/Street View correctly from ArcMap, however they fail to open correctly when the service has been published and added to the Flex Viewer. I have no idea where I can add a Google API key, which I think is the issue but not sure. Any help would be appreciated.

Thanks a lot,

John
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
AnthonyGiles
Honored Contributor
No probs John glad I could help. Please don't forget to mark the post answered.

How's the outside world treating you

Regards

Anthony

View solution in original post

0 Kudos
8 Replies
AnthonyGiles
Honored Contributor
John,

Are you sure its the Google API key thats causing the problem and not the way the URL is encoded in the Pop up. I have found that if your original hyperlink has %20 instead of spaces the popup replaces the % with %25 (the HTML code for %) so you end up with %2520 for spaces which cause the URL to be invalid.

The way to fix this is to do a find and replace in Arcmap of all the %20 and replace with a space.

Just a thought

Regards

Anthony
0 Kudos
JohnByrne
Deactivated User
Hi Anthony (Giggsy)


The first URL below is the correct URL as it should be to work in Google maps which it does. The second is the URL from the attribute within the Flex viewer which as you can see has the added %25 you mentioned.When I replace it with a space then it breaks the hyperlink! Not sure how to replace it, so any tips are welcome.

Cheers

John
0 Kudos
AnthonyGiles
Honored Contributor
John,

Not quite sure by your last post what you changed and which link stopped working. Did you replace %20 with spaces in your attribute table, and after doing so the link no longer worked in ArcMap? Or did you replace %25 with a space in your URL after you followed your link from the flex popup (if so you need to just remove the 25 after the % sign so it reads as the original %20).

Are you working with the source code for flex, if so I can direct you to where you would need to make the change to make it work.

Regards

Gigzy
0 Kudos
JohnByrne
Deactivated User
Hi Gigzy,

I replaced the %25 with a space initially and it broke the link. I then replaced the space with %20 and while the link worked again if still put the %25 back in once the layer has been published as a service and added back into the flex viewer.

I built it through the App Builder and I can doctor the various config files but not sure about the source code.

Cheers
0 Kudos
AnthonyGiles
Honored Contributor
John,

I dont quite understand how you replaced the %25 with a space originally because your original link should not have any %25 in it, this is something flex adds to replace the % sign.

If your original link is something like:

http://something.com/somthing%20Somethintelse

replace it so it looks like:

http://something.com/somthing Somethintelse

If this breaks the link in ArcMap you may need to have two fields, one that holds the link for arcmap and one that holds the link for your flex viewer if you cannot amend the source code for your viewer.

Regards

Anthony
0 Kudos
JohnByrne
Deactivated User
The attribute was saved as a STRING so when I changed it to a TEXT field it worked fine! For some reason the Flex viewer introduced that extra bit of code.

Thanks for your help
0 Kudos
AnthonyGiles
Honored Contributor
No probs John glad I could help. Please don't forget to mark the post answered.

How's the outside world treating you

Regards

Anthony
0 Kudos
JohnByrne
Deactivated User
Gigzy,

Yeah all is well, its not as bad as they make out, but I do miss the ages but hopefully not for long!!

That error still persisted so I wasnt the guru I thought I was but I spoke to Christy Malone at ESRI Ireland and he gave the following solution which was along your lines, so after a little playing I managed to get it to succeed. I have pasted in Christy's response and will close the post, thanks for all the help.

"This seems to be an issue with URL encoding occurring twice in the workflow. %25 is URL encoding for a % symbol. ( The reason it doesn't happen for 'normal' URL's is that there is no space or comma in them originally. ) So, the comma is first getting translated to %2C, then % is getting translated to %25. ( , -> %2C -> %252C ) . Similarly for a space (' ' - > %20 -> %2520 ) . Can you have a quick look at this thread : http://forums.arcgis.com/threads/83093-pop-up-hyperlinks-not-working-spaces-getting-translated-to-25... ?  The solution is to do a replace in the FlexViewer code, as suggested, as arcMap has already changed the spaces to be URL-Encoded. i.e. Unencode %20 to be a space , or %2C to be a comma before Flex encodes again."                                                                                                                                                       

John
0 Kudos