quarks
quarks

Reputation: 35276

GWT Fragment Idenfiers

So far what I have used with my gwt application is a simple FI, like #login, #welcome etc. However I want to "refactor" my application in a more descriptive way, I need make it this way:

http://localhost:8080/main#login
http://localhost:8080/main#search
http://localhost:8080/profile#<username>
http://localhost:8080/api
etc.

Can I do this with GWT?

Upvotes: 0

Views: 163

Answers (2)

milan
milan

Reputation: 12402

Yes, but /main and /profile are going to be separate (html) pages, so you'll have EntryPoint for each then (loading/unloading GWT modules). Is that want you want? Google's AdWords is an example (written in GWT), each tab is a separate HTML page (/dashboard/, /cm/CampaignMgmt, ...).

Upvotes: 1

Thomas Broyer
Thomas Broyer

Reputation: 64541

If you want to stay on the same GWT application, you'll have to use the HTML5 History API (pushState and onpopstate) instead of GWT's default History (or DefaultHistorian) implementation; which means your app would only work with browser supporting the HTML5 History API (or you'd have to provide a fallback).
This is possible with GWT, but if you don't know how to do it and/or how the HTML5 History API works, it'll cost you a lot (of time).

BTW, if you ever switch to the HTML5 History API, why keep some fragment identifiers?

The alternative is, as milan says, to split your app into smaller parts (/main, /profile, /api, etc.)

Upvotes: 2

Related Questions